コード例 #1
0
ファイル: ProfessionController.cs プロジェクト: gdtd11/ProfOr
        public ActionResult CreateProfession(ProfessionView model, HttpPostedFileBase file = null)
        {
            var profession = ProfessionMapping(model, file);
            _professionService.CreateProfession(profession);
            _unitOfWork.Commit();
            var prof = _professionService.GetByName(profession.Name);

            return Json(prof, JsonRequestBehavior.AllowGet);
        }
コード例 #2
0
ファイル: ProfessionController.cs プロジェクト: gdtd11/ProfOr
        private Profession ProfessionMapping(ProfessionView prof, HttpPostedFileBase file)
        {
            var profession = new Profession();
            profession.ImageData = new byte[file.ContentLength];
            profession.MimeType = file.ContentType;
            profession.Name = prof.Name;
            profession.Description = prof.Description;
            profession.ProfCathegoryId = prof.ProfCathegoryId;
            profession.VideoLinkId = prof.VideoLinkId;

            file.InputStream.Read(profession.ImageData, 0, file.ContentLength);

            return profession;
        }