public void AddNewShipper(Shipper shipper) { try { ctx.Shippers.Add(shipper); ctx.SaveChanges(); IsSuccessful = true; } catch { IsSuccessful = false; } }
public void ModifyShipper(Shipper shipper) { try { Shipper originalShipper = ctx.Shippers .Where(s => s.ShipperID == shipper.ShipperID) .Select(s => s).FirstOrDefault(); ctx.Entry(shipper).State = System.Data.EntityState.Modified; ctx.SaveChanges(); IsSuccessful = true; } catch (Exception) { IsSuccessful = false; } }