public int UpdateCurrency(CurrencyExchange theCurrency) { try { theCurrency.CurrencyExchangeRate = MakeCurrencyExchangeRequest(theCurrency); theCurrency.LastUpdated = DateTime.Now; //update the db using (var db = new PortVillasContext()) { db.Entry(theCurrency).State = EntityState.Modified; db.SaveChanges(); return 0; } } catch (Exception ex) { //log /* this.mailService.Mail("[email protected]!", "Problem in PRC with currency converter");*/ throw ex; } }
public ActionResult Edit(Customer customer) { if (ModelState.IsValid) { using (var db = new PortVillasContext()) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } } return RedirectToAction("Index"); }