public ActionResult Create(PeriodicalModel model) { if (model.UploadImage != null && ModelState.IsValid) { string filePath = System.IO.Path.GetFileName(model.UploadImage.FileName); model.UploadImage.SaveAs(Server.MapPath("~/Images/" + filePath)); model.ImageName = filePath; } else { DataForDropDown(); return(View(model)); } var modelBL = _mapper.Map <PeriodicalBL>(model); _periodical.Create(modelBL); return(RedirectToAction("Index")); }
// POST: api/Periodical public void Post([FromBody] PeriodicalDto periodical) { _periodicalService.Create(periodical.ToModel()); }