Example #1
0
        public JsonResult Edit(PulpitViewModel model, int marketingYearId)
        {
            string message = String.Empty;

            try
            {
                _pulpitService.UpdatePulpit(model, marketingYearId);
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            return(Json(new { message }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public void AddPulpit(PulpitViewModel model, int marketingYearId)
        {
            if (String.IsNullOrWhiteSpace(model.Number) || model.Section <= 0 || String.IsNullOrWhiteSpace(model.District) ||
                String.IsNullOrWhiteSpace(model.Forestry))
            {
                throw new Exception("Wystąpił nieznany błąd podczas dodawania ambony.");
            }

            var dto = new PulpitDto
            {
                Number      = model.Number,
                Section     = model.Section,
                District    = model.District,
                Forestry    = model.Forestry,
                HasRoof     = model.HasRoof,
                Description = model.Description,
                CreatedDate = model.CreatedDate,
                RemovedDate = model.RemovedDate
            };

            _pulpitDao.Insert(dto);
        }