コード例 #1
0
        public BasicResponse Save(ReportGroupItemDTO dto)
        {
            var response = new BasicResponse();
            try
            {
                var entity = new ReportGroupItem()
                {
                    Description = dto.Description,
                    Id = dto.Id,
                    Name = dto.Name,
                    GroupId  = dto.GroupId,
                    ReportOrder = dto.ReportOrder,
                    ReportUrl = dto.ReportUrl,
                    IsActive = true,
                };
                _reportGroupItemRepository.Save(entity);
                response.Status = true;
                response.Info = "Success";

            }

            catch (Exception ex)
            {
                response.Status = false;
                if (ex is DomainValidationException)
                {
                    var dex = ex as DomainValidationException;
                    response.Info = dex.FormatException();
                }
                else
                {
                    response.Status = false;
                    response.Info = ex.Message;
                }

            }
            return response;
        }
コード例 #2
0
        public ActionResult Create(ReportGroupItemDTO model)
        {
            try
            {

                model.Id = Guid.NewGuid();
                _reportGroupItemService.Save(model);

                return RedirectToAction("Index");
            }
            catch (DomainValidationException ve)
            {
                ve.DomainValidationErrors(ModelState);
                bind();
                return View();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                bind();
                return View();
            }
            return View();
        }
コード例 #3
0
 private ReportGroupItemDTO Map(ReportGroupItem entity)
 {
     if (entity == null)
         return null;
     var dto = new ReportGroupItemDTO
     {
         Description = entity.Description,
         GroupId = entity.GroupId,
         GroupName = entity.Group.Name,
         ReportOrder = entity.ReportOrder,
         ReportUrl = entity.ReportUrl,
         Id = entity.Id,
         IsActive = entity.IsActive,
         Name = entity.Name,
     };
     return dto;
 }