public bool UpdateComputer(Core.Models.Computer computer) { if (computer != null || computer.Id.ToString() != "") { int computerid = computer.Id; using (var db = new DBContext()) { var temp = db.Computers.FirstOrDefault(x => x.Id == computerid); PropertyCopier <Core.Models.Computer, Core.Models.Computer> .Copy(computer, temp); db.SaveChanges(); return(true); } } return(false); }
public bool InsertComputer(Core.Models.Computer computer) { try { using (var db = new DBContext()) { db.Computers.Add(computer); db.SaveChanges(); return(true); } } catch (Exception e) { } return(false); }