public JsonResult Edit(BLL.Model.Store Store) { try { var valid = TryUpdateModel(Store); if (valid) { var Stores = Operation.UpdateStore(Store); } //return RedirectToAction("Index"); return(Json(new { Valid = valid, Errors = GetErrorsFromModelState(), //StudentsPartial = studentPartialViewHtml })); } catch (Exception ex) { return(Json(new { result = "Error occured" //StudentsPartial = studentPartialViewHtml })); } }
public ActionResult Create(BLL.Model.Store Store) { try { // TODO: Add insert logic here var valid = TryUpdateModel(Store); if (valid) { var Stores = Operation.SaveStore(Store); //return RedirectToAction("Index"); //Index(); //return RedirectToAction("Index"); } return(Json(new { Valid = valid, Errors = GetErrorsFromModelState(), //StudentsPartial = studentPartialViewHtml })); } catch { return(View()); } }
/// <summary> /// Save data to Store table /// </summary> /// <param name="store"></param> /// <returns></returns> public bool SaveStore(BLL.Model.Store store) { db.Stores.Add( new Store() { Name = store.Name, Address = store.Address }); db.SaveChanges(); return(true); }
public ActionResult Delete(int?id, BLL.Model.Store Store) { try { var store = operations.DeleteStore(id); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(BLL.Model.Store store) { try { // TODO: Add update logic here operations.UpdateStore(store); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(BLL.Model.Store store) { try { operations.SaveStore(store); return(RedirectToAction("Index")); } catch (Exception ex) { return(View()); } }
public ActionResult Create(BLL.Model.Store Store) { try { var valid = Operation.SaveStore(Store); return(Json(new { Valid = valid, })); } catch { return(View()); } }
/// <summary> /// Update existing Store details /// </summary> /// <param name="store"></param> /// <returns></returns> public bool UpdateStore(BLL.Model.Store store) { var existingStore = db.Stores.FirstOrDefault(r => r.ID == store.Id); if (existingStore != null) { existingStore.Address = store.Address; existingStore.Name = store.Name; db.Stores.Attach(existingStore); db.Entry(existingStore).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(true); } else { return(false); } }
public JsonResult Edit(BLL.Model.Store Store) { try { var valid = Operation.UpdateStore(Store); return(Json(new { Valid = valid, //StudentsPartial = studentPartialViewHtml })); } catch (Exception ex) { return(Json(new { result = "Error occured" //StudentsPartial = studentPartialViewHtml })); } }