// GET: Provider/Edit/5 public ActionResult Delete(int id) { try { // TODO: Add delete logic here p.DeleteById(id); p.Commit(); return(RedirectToAction("getProviders")); } catch { return(View()); } }
public ActionResult CreateProvider(Provider providerForm) { try { Provider pr = new Provider(); ProviderService p = new ProviderService(); pr.Email = providerForm.Email; pr.Username = providerForm.Username; pr.Password = providerForm.Password; pr.ConfirmPassword = providerForm.ConfirmPassword; p.Add(pr); p.Commit(); return(RedirectToAction("getProviders")); } catch { return(View()); } }
static void Main(string[] args) { Provider p = new Provider { Username = "******", Password = "******", ConfirmPassword = "******", Email = "fjdkjkf", products = new List <Product> { } }; Provider p2 = new Provider { Username = "******", Password = "******", ConfirmPassword = "******", Email = "kdjfglkdfjlgj", products = new List <Product> { } }; ProviderService s = new ProviderService(); s.Add(p); s.Add(p2); s.Commit(); List <Provider> providers = new List <Provider>(); providers = s.getByName("marwen"); foreach (var item in providers) { System.Console.WriteLine(item.Password); } System.Console.ReadKey(); }