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 InsertMainboard(MainBoard Mainboard) { try { using (var db = new DBContext()) { db.MainBoards.Add(Mainboard); db.SaveChanges(); ActivityLogFunction.WriteActivity("Insert Mainboard"); return(true); } } catch (Exception e) { } return(false); }
public bool InsertHardware(Core.Models.Hardware Hardware) { try { using (var db = new DBContext()) { db.Hardwares.Add(Hardware); db.SaveChanges(); ActivityLogFunction.WriteActivity("Insert hardware"); } return(true); } catch (Exception e) { } return(false); }
public bool InsertCPU(Core.Models.CPU CPU) { try { using (var db = new DBContext()) { db.CPUs.Add(CPU); db.SaveChanges(); ActivityLogFunction.WriteActivity("Insert cpu"); } return(true); } catch (Exception e) { } return(false); }
public bool InsertKeyboard(Core.Models.Keyboard Keyboard) { try { using (var db = new DBContext()) { db.Keyboards.Add(Keyboard); db.SaveChanges(); ActivityLogFunction.WriteActivity("Insert keyboard"); } return(true); } catch (Exception e) { } return(false); }
public bool InsertRadiator(Core.Models.Radiator Radiator) { try { using (var db = new DBContext()) { db.Radiators.Add(Radiator); db.SaveChanges(); ActivityLogFunction.WriteActivity("Insert Radiator"); } return(true); } catch (Exception e) { } return(false); }
public bool DeleteRadiatorFromDeletedlist(int Id) { try { using (var db = new DBContext()) { var radiator = db.Radiators.FirstOrDefault(x => x.Id == Id); db.Radiators.Remove(radiator); db.SaveChanges(); ActivityLogFunction.WriteActivity("Delete Radiator"); } return(true); } catch (Exception e) { } return(false); }
public bool DeleteKeyboardFromDeletedlist(int Id) { try { using (var db = new DBContext()) { var keyboard = db.Keyboards.FirstOrDefault(x => x.Id == Id); db.Keyboards.Remove(keyboard); db.SaveChanges(); ActivityLogFunction.WriteActivity("Delete keyboard"); } return(true); } catch (Exception e) { } return(false); }
public bool DeleteVGAFromDeletedlist(int Id) { try { using (var db = new DBContext()) { var vga = db.VGAs.FirstOrDefault(x => x.Id == Id); db.VGAs.Remove(vga); db.SaveChanges(); ActivityLogFunction.WriteActivity("Delete VGA"); return(true); } } catch (Exception e) { } return(false); }
public bool RestoreVGA(int Id) { try { using (var db = new DBContext()) { var vga = db.VGAs.FirstOrDefault(x => x.Id == Id); vga.IsDeleted = false; db.SaveChanges(); ActivityLogFunction.WriteActivity("Restore VGA"); return(true); } } catch (Exception e) { } return(false); }
public bool DeleteHardwareFromDeletedlist(int Id) { try { using (var db = new DBContext()) { var hardware = db.Hardwares.FirstOrDefault(x => x.Id == Id); db.Hardwares.Remove(hardware); db.SaveChanges(); ActivityLogFunction.WriteActivity("Delete hardware"); } return(true); } catch (Exception e) { } return(false); }
public bool RestoreHardware(int Id) { try { using (var db = new DBContext()) { var hardware = db.Hardwares.FirstOrDefault(x => x.Id == Id); hardware.IsDeleted = false; db.SaveChanges(); ActivityLogFunction.WriteActivity("Restore hardware"); } return(true); } catch (Exception e) { } return(false); }
public bool RestoreMainboard(int Id) { try { using (var db = new DBContext()) { var mainboard = db.MainBoards.FirstOrDefault(x => x.Id == Id); mainboard.IsDeleted = false; db.SaveChanges(); ActivityLogFunction.WriteActivity("Restore Mainboard"); return(true); } } catch (Exception e) { } return(false); }
public bool RestoreRadiator(int Id) { try { using (var db = new DBContext()) { var radiator = db.Radiators.FirstOrDefault(x => x.Id == Id); radiator.IsDeleted = false; db.SaveChanges(); ActivityLogFunction.WriteActivity("Restore Radiator"); } return(true); } catch (Exception e) { } return(false); }
public bool DeleteRAM(int Id) { try { using (var db = new DBContext()) { var ram = db.RAMs.FirstOrDefault(x => x.Id == Id); ram.IsDeleted = true; db.SaveChanges(); ActivityLogFunction.WriteActivity("Delete Ram"); } return(true); } catch (Exception e) { } return(false); }
public bool RestoreCase(int Id) { try { using (var db = new DBContext()) { var Case = db.Cases.FirstOrDefault(x => x.Id == Id); Case.IsDelete = false; db.SaveChanges(); ActivityLogFunction.WriteActivity("Restore case"); return(true); } } catch (Exception e) { } return(false); }
public bool DeleteCPU(int Id) { try { using (var db = new DBContext()) { var cpu = db.CPUs.FirstOrDefault(x => x.Id == Id); cpu.IsDeleted = true; db.SaveChanges(); ActivityLogFunction.WriteActivity("Delete cpu"); return(true); } } catch (Exception e) { } return(false); }
public ActionResult Login_Post() { string username = "", password = ""; if (ModelState.IsValid) { try { username = Request.Form["Username"]; } catch (Exception e) { } try { password = Request.Form["Password"]; } catch (Exception e) { } if (_LoginService.AdminLogIn(username, password) == true) { var user = _UserService.CreateUser(username, Constants.ADMIN_ID, "admin"); Session[Constants.ADMIN_SESSION] = user; // write history ActivityLogFunction.WriteActivity(user.Name + " Login"); return(RedirectToAction("Index")); } } return(View()); }
public bool UpdateKeyboard(Core.Models.Keyboard Keyboard) { if (Keyboard == null) { return(false); } try { using (var db = new DBContext()) { int id = Keyboard.Id; var temp = db.Keyboards.FirstOrDefault(x => x.Id == id); PropertyCopier <Core.Models.Keyboard, Core.Models.Keyboard> .Copy(Keyboard, temp); db.SaveChanges(); ActivityLogFunction.WriteActivity("Update keyboard"); 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); }
public bool UpdateCPU(Core.Models.CPU CPU) { if (CPU == null) { return(false); } try { using (var db = new DBContext()) { int id = CPU.Id; var temp = db.CPUs.FirstOrDefault(x => x.Id == id); PropertyCopier <Core.Models.CPU, Core.Models.CPU> .Copy(CPU, temp); db.SaveChanges(); ActivityLogFunction.WriteActivity("Update case"); return(true); } } catch (Exception e) { } return(false); }
public bool UpdateHardware(Core.Models.Hardware Hardware) { if (Hardware == null) { return(false); } try { using (var db = new DBContext()) { int id = Hardware.Id; var temp = db.Hardwares.FirstOrDefault(x => x.Id == id); PropertyCopier <Core.Models.Hardware, Core.Models.Hardware> .Copy(Hardware, temp); db.SaveChanges(); ActivityLogFunction.WriteActivity("Update Hardware"); return(true); } } catch (Exception e) { } return(false); }
public bool UpdateRadiator(Core.Models.Radiator Radiator) { if (Radiator == null) { return(false); } try { using (var db = new DBContext()) { int id = Radiator.Id; var temp = db.Radiators.FirstOrDefault(x => x.Id == id); PropertyCopier <Core.Models.Radiator, Core.Models.Radiator> .Copy(Radiator, temp); db.SaveChanges(); ActivityLogFunction.WriteActivity("Update Radiator"); return(true); } } catch (Exception e) { } return(false); }