public HttpResponseMessage GetUser(logInDTO logIn) { try { userDTO userFound = logic.GetUser(logIn); return(Request.CreateResponse(HttpStatusCode.OK, userFound)); } catch (Exception ex) { return(Request.CreateErrorResponse( HttpStatusCode.InternalServerError, ErrorsManager.GetInnerMessage(ex))); } }
public HttpResponseMessage GeBranches(branchDTO branch) { try { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ErrorsManager.GetErrors(ModelState))); } List <branchDTO> getranch = logic.getBranch(); return(Request.CreateResponse(HttpStatusCode.OK, getranch)); } catch (Exception ex) { return(Request.CreateErrorResponse( HttpStatusCode.InternalServerError, ErrorsManager.GetInnerMessage(ex))); } }
public HttpResponseMessage AddProduct(userDTO user) { try { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ErrorsManager.GetErrors(ModelState))); } string addedProduct = logic.AddUser(user); return(Request.CreateResponse(HttpStatusCode.Created, addedProduct)); } catch (Exception ex) { return(Request.CreateErrorResponse( HttpStatusCode.InternalServerError, ErrorsManager.GetInnerMessage(ex))); } }