Ejemplo n.º 1
0
        public ActionResult Create(ReportGroupDTO model)
        {
            try
            {

                model.Id = Guid.NewGuid();
                _reportGroupService.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();
        }
Ejemplo n.º 2
0
        public BasicResponse Save(ReportGroupDTO dto)
        {
            var response = new BasicResponse();
            try
            {
                var entity = new ReportGroup
                {
                    Description = dto.Description,
                    Id = dto.Id,
                    Name = dto.Name,
                    ClientId  =dto.ClientId,
                    IsActive = true,
                };
                _reportGroupRepository.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;
        }
Ejemplo n.º 3
0
 private ReportGroupDTO Map(ReportGroup entity)
 {
     if (entity == null)
         return null;
     var dto = new ReportGroupDTO
     {
         Description = entity.Description,
         ClientId = entity.ClientId,
         ClientName = entity.Client.Name,
         Id = entity.Id,
         IsActive = entity.IsActive,
         Name = entity.Name,
     };
     return dto;
 }