public void UpdateServiceRep(ServiceRepresentativeView model) { using (var servreprepo = new ServiceRepresentativeRepository()) { ServiceRepresentative sr = servreprepo.GetByServRepNo(model.ServiceRepIdNo); if (sr != null) { sr.IDNumber = model.IDNumber; sr.Fullname = model.Fullname; sr.Email = model.Email; sr.ContactNo = model.ContactNo; servreprepo.Update(sr); } } ApplicationUser user = UserManager.FindById(model.IDNumber); if (user != null) { user.Email = model.Email; user.FullName = model.Fullname; } }
public void ArchiveServiceRep(string id) { var ArchiveRep = new ServiceRepresentativeRepository(); var ar = new ArchiveServiceRepresentativeRepository(); ServiceRepresentative e = ArchiveRep.GetByServRepNo(id); var user = con.Users.Find(e.IDNumber); if (e != null || user != null) { var arch = new ArchiveServiceRepresentative() { ServiceRepIdNo = e.ServiceRepIdNo, IDNumber = e.IDNumber, Fullname = e.Fullname, Email = e.Email, ContactNo = e.ContactNo }; con.Users.Remove(user); ar.Insert(arch); ArchiveRep.Delete(e); } }
public ServiceRepresentativeView GetbyServRepNo(string repno) { using (var sreprepo = new ServiceRepresentativeRepository()) { ServiceRepresentative sr = sreprepo.GetByServRepNo(repno); var srep = new ServiceRepresentativeView(); if (sr != null) { srep.ServiceRepIdNo = sr.ServiceRepIdNo; srep.IDNumber = sr.IDNumber; srep.Fullname = sr.Fullname; srep.Email = sr.Email; srep.ContactNo = sr.ContactNo; } return(srep); } }