public Core.Models.VGA LoadById(int Id) { Core.Models.VGA vga = null; using (var db = new DBContext()) { vga = db.VGAs.FirstOrDefault(x => x.Id == Id); } return(vga); }
public bool InsertVGA(Core.Models.VGA VGA) { try { using (var db = new DBContext()) { db.VGAs.Add(VGA); db.SaveChanges(); ActivityLogFunction.WriteActivity("Insert VGA"); return(true); } } catch (Exception e) { } return(false); }
public bool UpdateVGA(Core.Models.VGA VGA) { if (VGA == null) { return(false); } try { using (var db = new DBContext()) { int id = VGA.Id; var temp = db.VGAs.FirstOrDefault(x => x.Id == id); PropertyCopier <Core.Models.VGA, Core.Models.VGA> .Copy(VGA, temp); db.SaveChanges(); ActivityLogFunction.WriteActivity("Update VGA"); return(true); } } catch (Exception e) { } return(false); }