public static int FirmOwner(int user_id, int systemAdminId) { try { using (couponEntities2 ce = new couponEntities2()) { Firm_Owner firmOwner = new Firm_Owner { Id = user_id, Sytem_Admin_Id = systemAdminId }; ce.Firm_Owner.Add(firmOwner); ce.SaveChanges(); return(firmOwner.Id); } } catch (Exception) { return(-1); } }
public static bool UpdateFirmOwner(Firm_Owner firmOwner) { try { using (couponEntities2 ce = new couponEntities2()) { var result = ce.Firm_Owner.SingleOrDefault(b => b.Id == firmOwner.Id); if (result != null) { result.Sytem_Admin = firmOwner.Sytem_Admin; result.Sytem_Admin_Id = firmOwner.Sytem_Admin_Id; result.User = firmOwner.User; result.Firms = firmOwner.Firms; ce.SaveChanges(); } } } catch (Exception) { return(false); } return(true); }