public static ProcessResult AddProduct(int enterpriseId, Product product, HttpPostedFileBase imageUpload) { var enterprise = EnterpriseManager.GetEnterprise(ent => ent.Id == enterpriseId); if (enterprise == null) { return(ProcessResults.EnterpriseNotExisting); } var exists = mobiMarket.Products.Any(pr => pr.Name == product.Name); if (exists) { return(ProcessResults.ProductAlreadyExists); } product.PicturePath = SaveProductImage(imageUpload, product.Name); mobiMarket.Products.Add(product); mobiMarket.SaveChangesAsync(); return(ProcessResults.ProductSuccessfullyAdded); }