예제 #1
0
        public IHttpActionResult Post([FromBody] Measurement entity)
        {
            try
            {
                _MeasurementSvc.Create(entity);
                _data.SaveChanges();
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }

            return(Created(entity));
        }
예제 #2
0
        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));
        }