public ActionResult CircleEdit(int?id) //+ { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } try { CirlceBll c = _figuresService.GetCirlceById(id.Value); CircleCreatingAndEditingView cv = new CircleCreatingAndEditingView() { Id = c.Id, Name = c.Name, Radius = c.Radius.ToString() }; return(View(cv)); } catch (DataNotFoundException ex) { return(RedirectToAction("DataNotFound", "Error", new { message = ex.Message })); } catch (Exception ex) { return(HttpNotFound(ex.Message)); } /* * ActionResult CircleEdit(PagingInfoView pagingInfoView, int? id)//+ * pass values from Html.BeginForm into controller * @Html.HiddenFor(model => pagingInfoView.TotalItems) * @Html.HiddenFor(model => pagingInfoView.CurrentPage) * @Html.HiddenFor(model => pagingInfoView.ItemsPerPage) * * @Html.HiddenFor(model => id) */ }
public ActionResult CircleCreate(CircleCreatingAndEditingView c)//+ { 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.CreateCirlce(new CirlceBll(null, 0, c.Name, float.Parse(c.Radius))); return(RedirectToAction("Circles")); } catch (Exception ex) { return(HttpNotFound(ex.Message)); } } return(View(c)); }