public ActionResult DestroyAreaScopeAsync(int id)
        {
            AreaScopeViewModel obj = mainRepository.GetAreaScopeById(id);

            mainRepository.DeleteAreaScope(obj);
            return(Json(""));
        }
        public void InsertAreaScope(AreaScopeViewModel areaScopeVM)
        {
            AreaScope newRecord = new AreaScope {
                AS_Scope = areaScopeVM.Name.Trim()
            };

            context.AreaScopes.Add(newRecord);
            context.SaveChanges();
        }
        public void UpdateAreaScope(AreaScopeViewModel areaScopeVM)
        {
            AreaScope newRecord = new AreaScope {
                AS_Id = areaScopeVM.Id, AS_Scope = areaScopeVM.Name
            };

            context.AreaScopes.Attach(newRecord);
            context.Entry(newRecord).State = EntityState.Modified;
            context.SaveChanges();
        }
 public void DeleteAreaScope(AreaScopeViewModel areaScopeVM)
 {
     try
     {
         AreaScope newRecord = new AreaScope {
             AS_Id = areaScopeVM.Id, AS_Scope = areaScopeVM.Name
         };
         context.AreaScopes.Attach(newRecord);
         context.AreaScopes.Remove(newRecord);
         context.SaveChanges();
     } catch (Exception ex)
     {
         throw ex;
     }
 }
 public ActionResult UpdateAreaScope([DataSourceRequest] DataSourceRequest request, AreaScopeViewModel obj)
 {
     if (ModelState.IsValid)
     {
         mainRepository.UpdateAreaScope(obj);
     }
     return(Json(new[] { obj }.ToDataSourceResult(request, ModelState)));
 }
 public ActionResult DestroyAreaScope([DataSourceRequest] DataSourceRequest request, AreaScopeViewModel obj)
 {
     mainRepository.DeleteAreaScope(obj);
     return(Json(new[] { obj }.ToDataSourceResult(request, ModelState)));
 }