public IHttpActionResult Post([FromBody] Measurement entity) { try { _MeasurementSvc.Create(entity); _data.SaveChanges(); } catch (Exception ex) { return(InternalServerError(ex)); } return(Created(entity)); }
public ActionResult Create(CreateMeasurementViewModel viewModel) { var request = viewModel.MapTo <CreateMeasurementRequest>(); var response = _measurementService.Create(request); TempData["IsSuccess"] = response.IsSuccess; TempData["Message"] = response.Message; if (response.IsSuccess) { return(RedirectToAction("Index")); } return(View("Create", viewModel)); }