public ActionResult StoreCreate(FigureStoreCreatingAndEditingView fs) // + { if (ModelState.IsValid) //todo else { try { _figuresService.CreateFigureStore(new FiguresStoreBll(0, fs.Name)); return(RedirectToAction("FigureStoreList")); } catch (Exception ex) { return(HttpNotFound(ex.Message)); } } return(View(fs)); }
public ActionResult StoreEdit(FigureStoreCreatingAndEditingView fs)// + { if (ModelState.IsValid) { //Range validation where value is with comma and not with dot //https://laracasts.com/discuss/channels/general-discussion/validate-numeric-with-both-comma-and-dot-nottation?page=1 { try { _figuresService.UpdateStore(new FiguresStoreBll(fs.Id, fs.Name)); return(RedirectToAction("FigureStoreList")); } catch (DataNotFoundException ex) { return(RedirectToAction("DataNotFound", "Error", new { message = ex.Message })); } catch (Exception ex) { return(HttpNotFound(ex.Message)); } } } return(View(fs)); }
public ActionResult StoreEdit(int?id) // + { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } try { FiguresStoreBll fs = _figuresService.GetStoreById(id.Value); FigureStoreCreatingAndEditingView fscv = new FigureStoreCreatingAndEditingView() { Id = fs.Id, Name = fs.Name }; return(View(fscv)); } catch (DataNotFoundException ex) { return(RedirectToAction("DataNotFound", "Error", new { message = ex.Message })); } catch (Exception ex) { return(HttpNotFound(ex.Message)); } }