public ActionResult CreateProfCathegory(ProfCathegoryView model, HttpPostedFileBase file = null) { var profCathegory = ProfCathegoryMapping(model, file); _profCathegoryService.CreateProfCathegory(profCathegory); _unitOfWork.Commit(); var prof = _profCathegoryService.GetByName(model.Name); return Json(prof, JsonRequestBehavior.AllowGet); }
private ProfCathegory ProfCathegoryMapping(ProfCathegoryView prof, HttpPostedFileBase file) { var profCathegory = new ProfCathegory(); profCathegory.ImageData = new byte[file.ContentLength]; profCathegory.MimeType = file.ContentType; profCathegory.Name = prof.Name; profCathegory.Description = prof.Description; file.InputStream.Read(profCathegory.ImageData, 0, file.ContentLength); return profCathegory; }