コード例 #1
0
        public IHttpActionResult Post(CreateRankViewModel newModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _service.Create(_mapper.Map <Rank>(newModel));
            return(Ok());
        }
コード例 #2
0
        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"));
        }