public IHttpActionResult Post(CreateRankViewModel newModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _service.Create(_mapper.Map <Rank>(newModel)); return(Ok()); }
public ActionResult CreateRank(CreateRankViewModel data) { var path = Server.MapPath("~/Images"); var rankdto = new RankDto() { CreatedDate = DateTime.Now, RankName = data.RankName, RankImage = "../Images/" + FileUlti.SaveFile(data.RankImage, path) }; _rankService.Create(rankdto); return(RedirectToAction("RankManagement")); }