Esempio n. 1
0
        public async Task <IActionResult> UpdateGroupAsync([FromBody] UpdateBlockAc updateComponentGroupAc)
        {
            if (string.IsNullOrEmpty(updateComponentGroupAc.Name.Trim()))
            {
                return(Ok(new SharedLookUpResponse()
                {
                    HasError = true,
                    ErrorType = SharedLookUpResponseType.Name,
                    Message = "Block name can't be null or empty"
                }));
            }
            else
            {
                var instituteId = await GetUserCurrentSelectedInstituteIdAsync();

                if (await iMSDbContext.BookTypes.AnyAsync(x => x.Id == updateComponentGroupAc.Id && x.InstituteId == instituteId))
                {
                    return(Ok(await blockManagementRepository.UpdateComponentAsync(updateComponentGroupAc, instituteId)));
                }
                else
                {
                    return(Ok(new SharedLookUpResponse()
                    {
                        HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Block not found"
                    }));
                }
            }
        }