Beispiel #1
0
        public ActionResult CreateProfEvent(ProfEventView model, HttpPostedFileBase file = null)
        {
            var profEvent = ProfEventMapping(model, file);
            _profEventService.CreateProfEvent(profEvent);
            _unitOfWork.Commit();

            return Json("", JsonRequestBehavior.AllowGet);
        }
Beispiel #2
0
        private ProfEvent ProfEventMapping(ProfEventView model, HttpPostedFileBase file)
        {
            var profEvent = new ProfEvent();
            profEvent.ImageData = new byte[file.ContentLength];

            TimeSpan time = new TimeSpan(model.Time.Hour, model.Time.Minute, 0);
            var date = new DateTime(model.Date.Year, model.Date.Month, model.Date.Day).Add(time);
            profEvent.Name = model.Name;
            profEvent.Place = model.Place;
            profEvent.Description = model.Description;
            profEvent.StartDateTime = date;
            profEvent.MimeType = file.ContentType;
            file.InputStream.Read(profEvent.ImageData, 0, file.ContentLength);
            return profEvent;
        }