public int Save(tblCast tbl) { tbl.IsDelete = false; objData.tblCasts.Add(tbl); objData.SaveChanges(); return(tbl.CastId.Value); }
public ActionResult Update(tblCast model) { var countries = objCast.GetCasts(); var test = countries.Where(p => p.CastName.ToUpper() == model.CastName.ToUpper() && p.ReligionId == model.ReligionId).FirstOrDefault(); CastDetails obj = new CastDetails(); if (test != null) { obj.Status = false; obj.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.AlreadyExist : "हि माहिती आधीपासून उपलब्ध आहे."; } else { obj.Status = true; obj.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.InformationSave : "माहिती सेव केली आहे."; objCast.Update(model); } int pageindex = 0; var filter = countries.OrderBy(p => p.CastId).Skip(pageindex * PageSize).Take(PageSize); Session["users"] = countries; Session["pageindex"] = 0; obj.CastList = filter; return(Json(obj, JsonRequestBehavior.AllowGet)); }
internal void Update(tblCast model) { tblCast newobj = objData.tblCasts.Where(p => p.CastId == model.CastId && p.IsDelete == false).FirstOrDefault(); newobj.CastName = model.CastName; newobj.ReligionId = model.ReligionId; objData.SaveChanges(); }