public ActionResult Index() { etblPropertySpaMap obj = new etblPropertySpaMap(); obj = BL_tblPropertySpaMap.GetSingleRecordById(Convert.ToInt32(Session["PropId"])); return(View("~/Views/Spa/view.cshtml", obj)); }
//Update a record public static int UpdateRecord(etblPropertySpaMap eobj, bool Type) { int retval = 0; using (OneFineRateEntities dbnew = new OneFineRateEntities()) { try { OneFineRate.tblPropertySpaMap obj = (OneFineRate.tblPropertySpaMap)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblPropertySpaMap()); if (Type) { dbnew.tblPropertySpaMaps.Attach(obj); dbnew.Entry(obj).State = System.Data.Entity.EntityState.Modified; dbnew.SaveChanges(); retval = 1; } else { dbnew.tblPropertySpaMaps.Add(obj); dbnew.SaveChanges(); retval = 1; } } catch (Exception) { throw; } } return(retval); }
//Get Single Record public static etblPropertySpaMap GetSingleRecordById(int id) { etblPropertySpaMap eobj = new etblPropertySpaMap(); using (OneFineRateEntities db = new OneFineRateEntities()) { var dbobj = db.tblPropertySpaMaps.SingleOrDefault(u => u.iPropId == id); if (dbobj != null) { eobj = (etblPropertySpaMap)OneFineRateAppUtil.clsUtils.ConvertToObject(dbobj, eobj); } } return(eobj); }
public ActionResult Modify(etblPropertySpaMap obj) { try { if (ModelState.IsValid) { try { bool type = false; obj.dtActionDate = DateTime.Now; obj.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId; obj.iPropId = Convert.ToInt32(Session["PropId"]); string Name = BL_tblPropertySpaMap.CheckDataExist(obj.iPropId); if (Name != string.Empty) { type = true; } int result = BL_tblPropertySpaMap.UpdateRecord(obj, type); if (result == 1) { TempData["msg"] = "Wellness Facilites Modified Successfully"; return(RedirectToAction("Index")); } else { TempData["ERROR"] = "Kindly try after some time."; return(RedirectToAction("Index")); } } catch (Exception) { TempData["ERROR"] = "Kindly try after some time."; throw; } } } catch (Exception) { TempData["ERROR"] = "Kindly try after some time."; } return(View("~/Views/Spa/view.cshtml", obj)); }
//Add new record public static int AddRecord(etblPropertySpaMap eobj) { int retval = 0; using (OneFineRateEntities db = new OneFineRateEntities()) { try { OneFineRate.tblPropertySpaMap dbuser = (OneFineRate.tblPropertySpaMap)OneFineRateAppUtil.clsUtils.ConvertToObject(eobj, new OneFineRate.tblPropertySpaMap()); db.tblPropertySpaMaps.Add(dbuser); db.SaveChanges(); retval = 1; } catch (Exception) { throw; } } return(retval); }