HoloXPLOR.Models.HoloTable.DetailModel.Delete C# (CSharp) Method

Delete() public method

public Delete ( ) : void
return void
        public void Delete()
        {
            CacheUtils.Cache.Remove(this.CacheKey);

            String filename = HttpContext.Current.Server.MapPath(String.Format(@"~/App_Data/Inventory/{0}.xml", this.CurrentXML));

            if (System.IO.File.Exists(filename))
            {
                System.IO.File.Delete(filename);
            }
        }

Usage Example

        public ActionResult Delete(String id)
        {
            if (String.Equals("sample", id, StringComparison.InvariantCultureIgnoreCase))
            {
                return RedirectToRoute("NotAllowed");
            }

            HoloTableController._lockMap[id] = HoloTableController._lockMap.GetValue(id, new Object());

            lock (HoloTableController._lockMap[id])
            {
                var model = new DetailModel(id);

                if (model != null)
                {
                    model.Delete();
                }
            }

            return View();
        }