public JsonResult GetStoneDetail(int stoneId) { Stone stone = StoneDbModel.GetStoneModel(stoneId); StoneViewModel stoneviewModel = helper.GetViewModelFromDbStone(stone); return(Json(stoneviewModel, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveStone(StoneViewModel stoneViewModel) { string message = ""; try { if (stoneViewModel != null) { Stone stone = helper.GetStoneObjectFromViewModelStone(stoneViewModel); if (stone != null) { if (stone.StoneId > 0) { message = "Stone details updated successfully"; StoneDbModel.UpdateStone(stone); } else { message = "Stone created successfully"; StoneDbModel.SaveStone(stone); } } else { message = "Application was not able to create Stone, contact Admin"; } } } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); message = ex.Message; } return(Json(new { UpdateMessage = message })); }
public ActionResult DisplayAllStone() { var allStoneFromDb = StoneDbModel.GetAllStonesFromDB(); List <StoneViewModel> stoneViewModelCollection = helper.GetViewModelFromDbStoneCollection(allStoneFromDb); return(View("Stone", stoneViewModelCollection)); }
public ActionResult CreateNew() { List <Stone> stones = StoneDbModel.GetAllStonesFromDB(); List <Finding> findings = FindingDbModel.GetAllFindingsFromDB(); List <Category> categories = CategoryDbModel.GetAllCategoryFromDB(); ProductItem item = new ProductItem(); item.Stones = stones; item.Findings = findings; item.Categories = categories; return(View(item)); }
public ActionResult Index() { List <Stone> stones = StoneDbModel.GetAllStonesFromDB(); List <Finding> findings = FindingDbModel.GetAllFindingsFromDB(); List <Category> categories = CategoryDbModel.GetAllCategoryFromDB(); ProductItem item = new ProductItem(); var productCollection = ProductDbModel.GetAllProduct(); item.Stones = stones; item.Findings = findings; item.Categories = categories; return(View(productCollection)); }
public JsonResult DeleteStone(int stoneId) { string message = "Stone deleted successfuly"; try { StoneDbModel.DeleteStone(stoneId); } catch (Exception ex) { message = ex.Message; Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } return(Json(new { DeleteMessage = message })); }