public async Task <bool> EditAllergicAsync(long id, EditAllergicInput input)
        {
            var record = await _allergicRepository.FirstOrDefaultAsync(x => x.Id == id);

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

            _mapper.Map(input, record);
            record.LastModifierUserId = GetCurrentUser();

            await CurrentUnitOfWork.SaveChangesAsync();

            return(true);
        }
        public async Task <AppResponse <bool> > EditAllergicAsync(long id, EditAllergicInput input)
        {
            bool isSurgeryExist = await _systemtLookupsManager.IsAllergicExistAsync(input.Name);

            if (isSurgeryExist)
            {
                return new AppResponse <bool>
                       {
                           IsSuccessful      = false,
                           StatusCode        = StatusCodes.ENTITY_ALREADY_EXIST,
                           StatusDescription = string.Format(L("NameExist"), L("Allergic"))
                       }
            }
            ;

            return(new AppResponse <bool>
            {
                Data = await _systemtLookupsManager.EditAllergicAsync(id, input),
                IsSuccessful = true,
                StatusCode = StatusCodes.SUCCESS,
                StatusDescription = L("Updated")
            });
        }
Пример #3
0
        public async Task <IActionResult> EditAllergicAsync(long id, [FromBody] EditAllergicInput input)
        {
            AppResponse <bool> response = await _systemLookupsService.EditAllergicAsync(id, input);

            return(Ok(response));
        }