// POST: api/ClaimApi public HttpResponseMessage Post([FromBody] ClaimModel model) { try { model.StatusId = AttributeProviderSvc.GetClaimStatusIdFromName("new"); var entity = AutoMapper.Mapper.Map <Claim>(model); Uow.Claims.Add(entity); Uow.SaveChanges(); if (string.IsNullOrEmpty(model.ReturnUrl)) { //return RedirectToAction("Index"); return(Request.CreateResponse(HttpStatusCode.OK, new { returnUrl = "Index" })); } else { return(Request.CreateResponse(HttpStatusCode.OK, new { returnUrl = model.ReturnUrl })); //return Redirect(model.ReturnUrl); } } catch { return(Request.CreateResponse(HttpStatusCode.BadRequest)); //return View(); } }
public ActionResult Create(ClaimModel model) { try { model.StatusId = AttributeProviderSvc.GetClaimStatusIdFromName("new"); var entity = AutoMapper.Mapper.Map <Claim>(model); Uow.Claims.Add(entity); Uow.SaveChanges(); if (string.IsNullOrEmpty(model.ReturnUrl)) { return(RedirectToAction("Index")); } else { return(Redirect(model.ReturnUrl)); } } catch { return(View()); } }