public ActionResult MyProducts() { if (LoginControl.ControlLogin() != null) { ViewBag.PageInfo = "ÜRÜNLERİM"; HttpResponseMessage result = WebApiRequestOperation.WebApiRequestOperationMethodForUser(SystemConstannts.WebApiDomainAddress, "api/UserProfile/GetMyProducts", (HttpContext.Session["User"] as Takas.Common.Entities.Concrete.User)); GetUserProductResponse response = null; if (result.StatusCode == HttpStatusCode.OK) { string resultString = result.Content.ReadAsStringAsync().Result; if (!resultString.Contains("{\"Products\":null")) { response = Newtonsoft.Json.JsonConvert.DeserializeObject <GetUserProductResponse>(resultString); } } return(View(response)); } return(View("NotFound")); }
public object GetMyProducts(User user) { // List<Product> myProducts = _productService.GetListByUserId(user.ID); GetUserProductResponse response = new GetUserProductResponse(); try { var List = _productService.GetProductList(user.ID); if (List == null) { response.Products = null; response.setError(Common.SystemConstants.SystemConstannts.ERROR_CODES.NOTFOUND); } response.Products = List; response.setError(Common.SystemConstants.SystemConstannts.ERROR_CODES.SUCCESS); }catch (Exception ex) { response.setError(Common.SystemConstants.SystemConstannts.ERROR_CODES.SYSTEMERROR); response.Products = null; } return(response); }