Exemple #1
0
        public async Task <IActionResult> AddResponseResident(int condominiumId, int pollId, [FromHeader] string Authorization, [FromBody] RequestOptionResident request)
        {
            try
            {
                var resident = await _residentService.AuthToken(Authorization);

                if (resident == null)
                {
                    UnauthorizedResponse();
                    return(new ObjectResult(response));
                }

                var optionResident = new OptionResident()
                {
                    Comment        = request.Comment,
                    Date           = DateTime.Now,
                    IsDelete       = false,
                    OptionId       = request.OptionId,
                    ResidentId     = resident.ResidentId,
                    ResidentUserId = resident.UserId,
                };

                var optionResidentSaved = await _optionResidentService.Insert(optionResident);

                OkResponse(optionResidentSaved);
                return(new ObjectResult(response));
            }
            catch (Exception e)
            {
                InternalServerErrorResponse(e.Message);
                return(new ObjectResult(response));
            }
        }
Exemple #2
0
 public async Task <OptionResident> Update(OptionResident entity)
 {
     return(await _optionResidentRepository.Update(entity));
 }
Exemple #3
0
 public async Task <OptionResident> Insert(OptionResident entity)
 {
     return(await _optionResidentRepository.Insert(entity));
 }