public BaseResponse <User> Check(FormDataCollection form) { BaseResponse <User> response = null; try { string token = form.Token; User user = businessLogicLayer.Check(token); response = new BaseResponse <User>(user); } catch (Exception ex) { response = new BaseResponse <User> { Error = ex.Message }; } return(response); }
public BaseResponse <int> Add([FromBody] Food food) { BaseResponse <int> response = null; try { string token = Request.Headers["Auth"]; User user = businessLogicLayer.Check(token); int foodId = businessLogicLayer.AddFoodWithProducts(user.Id, food); response = new BaseResponse <int>(foodId); } catch (Exception ex) { response = new BaseResponse <int> { Error = ex.Message }; } return(response); }