public int AddRole(TatooineModel.Roles Rol) { using (var db = new TatooineCitizensRegistryEntities()) { db.Roles.Add(Rol); db.SaveChanges(); return Rol.Id; } }
public long AddCitizen(TatooineModel.Citizens Citizen) { using (var db = new TatooineCitizensRegistryEntities()) { db.Citizens.Add(Citizen); db.SaveChanges(); return Citizen.Id; } }
public bool DeleteCitizen(string CitizenID) { using (var db = new TatooineCitizensRegistryEntities()) { var Citizen = db.Citizens.SingleOrDefault(p => p.Id == long.Parse(CitizenID)); db.Citizens.Remove(Citizen); db.SaveChanges(); return true; } }
public bool UpdateRole(TatooineModel.Roles Rol) { using (var db = new TatooineCitizensRegistryEntities()) { var RolBD = db.Roles.SingleOrDefault(p => p.Id == Rol.Id); RolBD.RoleName = Rol.RoleName; RolBD.ParentId = Rol.ParentId; db.SaveChanges(); return true; } }
public bool DeleteRole(string Id) { using (var db = new TatooineCitizensRegistryEntities()) { int id = int.Parse(Id); var Rol = db.Roles.SingleOrDefault(p => p.Id == id); db.Roles.Remove(Rol); db.SaveChanges(); return true; } }
public bool UpdateCitizen(TatooineModel.Citizens Citizen) { using (var db = new TatooineCitizensRegistryEntities()) { var CitizenDB = db.Citizens.SingleOrDefault(p => p.Id == Citizen.Id); CitizenDB.Name = Citizen.Name; CitizenDB.Specie = Citizen.Specie; CitizenDB.IdRole = Citizen.IdRole; CitizenDB.IdStatus = Citizen.IdStatus; db.SaveChanges(); return true; } }