public IActionResult Get(string id) { var response = new SingleResponseModel <UserModel>(); try { var user = _userRepository.GetById(id); if (user == null) { response.DidError = true; response.Message = "User not found"; } else { response.Model = UserModel.ToModel(user); } } catch (Exception exception) { response.DidError = true; response.Message = exception.Message; _logger.LogError(exception.Message); } return(response.ToHttpResponse()); }
public async Task <IActionResult> ProductDelete([FromBody] ProductDTO productDTO) { var response = new SingleResponseModel <ProductDTO>(); try { var data = await _productService.ProductDelete(productDTO); response.Model = data; } catch (Exception ex) { response.DidError = true; response.ErrorMessage = "There was an internal error, please contact to technical support."; } return(response.ToHttpResponse()); }
public async Task <IActionResult> OrderUpdate([FromBody] OrderDTO orderDTO) { var response = new SingleResponseModel <OrderDTO>(); try { var data = await _orderUpdate.OrderUpdate(orderDTO); response.Model = data; } catch (Exception ex) { response.DidError = true; response.ErrorMessage = "There was an internal error, please contact to technical support."; } return(response.ToHttpResponse()); }
public async Task <IActionResult> UserTypeEntryUpdate([FromBody] UserTypeDTO userTypeDTO) { var response = new SingleResponseModel <UserTypeDTO>(); try { var data = await _userTypeService.UserTypeEntryUpdate(userTypeDTO); response.Model = data; } catch (Exception ex) { response.DidError = true; response.ErrorMessage = "There was an internal error, please contact to technical support."; } return(response.ToHttpResponse()); }
public async Task <IActionResult> LoginEmployee([FromBody] LoginDataModel loginDataModel) { var response = new SingleResponseModel <LoginResponse>(); try { var data = await _loginService.LoginEmployee(loginDataModel); response.Model = data; } catch (Exception ex) { response.DidError = true; response.ErrorMessage = "There was an internal error, please contact to technical support."; } return(response.ToHttpResponse()); }
public async Task <IActionResult> CustomerEntry([FromBody] CustomerDTO customerDTO) { var response = new SingleResponseModel <CustomerDTO>(); try { var data = await _customerService.CustomerEntry(customerDTO); response.Model = data; } catch (Exception ex) { response.DidError = true; response.ErrorMessage = "There was an internal error, please contact to technical support."; } return(response.ToHttpResponse()); }
public async Task <IActionResult> Update([FromBody] Person person) { var response = new SingleResponseModel <Person>() as ISingleResponseModel <Person>; try { var entity = await _servicePeople.Update(person); response.Model = entity; } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.ToHttpResponse()); }
public async Task <IActionResult> Get(string id) { var response = new SingleResponseModel <Person>(); try { var entity = await _servicePeople.Get(new FilterDefinitionBuilder <Person>().Where(x => x.Id == id)); response.Model = entity; } catch (Exception ex) { response.DidError = true; response.ErrorMessage = ex.Message; } return(response.ToHttpResponse()); }