Ejemplo n.º 1
0
        public IActionResult SaveConsentGroup(ConsentGroupModel consentGroupModel)
        {
            var consentGroup = consentGroupModel.Id > 0 ? _consentGroupService.Get(consentGroupModel.Id) : new ConsentGroup();

            if (consentGroup == null)
            {
                return(NotFound());
            }

            consentGroup.Name        = consentGroupModel.Name;
            consentGroup.Description = consentGroupModel.Description;
            _consentGroupService.InsertOrUpdate(consentGroup);

            return(R.Success.Result);
        }
Ejemplo n.º 2
0
        public ConsentGroupModel Create(ConsentGroup entity)
        {
            var consentGroupModel = new ConsentGroupModel()
            {
                Name        = entity.Name,
                Description = entity.Description,
                Id          = entity.Id
            };

            if (entity.Consents?.Any() ?? false)
            {
                consentGroupModel.Consents = entity.Consents.Select(Create).ToList();
            }
            return(consentGroupModel);
        }