Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateCondominium(int condominiumId, [FromHeader] string Authotization, [FromBody] Condominium request)
        {
            try
            {
                request.CondominiumId = condominiumId;
                var condominiumSaved = await _condominiumService.Update(request);

                OkResponse(condominiumSaved);
                return(new ObjectResult(response));
            }
            catch (Exception e)
            {
                InternalServerErrorResponse(e.Message);
                return(new ObjectResult(response));
            }
        }
Ejemplo n.º 2
0
 public ActionResult Put(int id, [FromBody] AddCondominiumRequestModel model)
 {
     try
     {
         var condominium = _condominiumService.Get(id);
         condominium.Status     = model.Status;
         condominium.UpdatedAt  = today;
         condominium.Name       = model.Name;
         condominium.Address    = model.Address;
         condominium.PhotoUrl   = model.PhotoUrl;
         condominium.SecretCode = model.SecretCode;
         _condominiumService.Update(condominium);
         response.StatusCode = StatusCodes.Status200OK;
         response.Status     = "OK";
         response.Message    = "Condominio actualizado";
         return(Ok(response));
     }
     catch (Exception e)
     {
         response.StatusCode = StatusCodes.Status400BadRequest;
         response.Status     = "BAD REQUEST";
         response.Message    = e.Message;
         return(BadRequest(response));
     }
 }