示例#1
0
        public async Task <Response <string> > UpdateAsync(CamareroDTO model)
        {
            var response = new Response <string>();

            try
            {
                var resp = _mapper.Map <Camarero>(model);
                response.Data = await _CamarerosDomain.UpdateAsync(resp);

                if (response.Data == "success")
                {
                    response.IsSuccess = true;
                    response.Message   = "Se ha actualizado el Camarero exitosamente.";
                }
                else
                {
                    response.IsSuccess = false;
                    response.Message   = "Ha ocurrido un error inesperado, por favor intente nuevamente";
                }
            }
            catch (Exception ex)
            {
                response.IsSuccess = false;
                response.Message   = ex.Message;
            }

            return(response);
        }
示例#2
0
        public async Task <IActionResult> UpdateAsync(CamareroDTO model)
        {
            Response <string> response = new Response <string>();

            try
            {
                if (model == null)
                {
                    return(BadRequest());
                }

                response = await _CamareroApplication.UpdateAsync(model);

                if (response.IsSuccess)
                {
                    return(Ok(response));
                }
                else
                {
                    return(BadRequest(response));
                }
            }
            catch (Exception ex)
            {
                response.Data      = null;
                response.IsSuccess = false;
                response.Message   = ex.Message;

                return(BadRequest(response));
            }
        }