示例#1
0
        public async Task <ActionResult> Update(int id, UpdateLegalEntityRequestModel model)
        {
            var result = await this.legalEntityService.Update(id, model);

            if (!result)
            {
                return(BadRequest());
            }

            return(NoContent());
        }
示例#2
0
        public async Task <bool> Update(int id, UpdateLegalEntityRequestModel model)
        {
            var legalEntity = await this.data.LegalEntity.FindAsync(id);

            if (legalEntity == null)
            {
                return(false);
            }

            if (!string.IsNullOrWhiteSpace(model.Description) && legalEntity.Description != model.Description)
            {
                legalEntity.Description = model.Description;
            }

            if (legalEntity.RegulatoryId != model.RegulatoryId)
            {
                legalEntity.RegulatoryId = model.RegulatoryId;
            }

            await this.data.SaveChangesAsync();

            return(true);
        }