예제 #1
0
 public RegisterdNotaryCompany Create(NewNotaryCompany creationRequest)
 {
     using (DocumentManagementDB db = new DocumentManagementDB())
     {
         NotaryCompany newNotary = Mapper.Map <NotaryCompany>(creationRequest);
         db.NotaryCompanies.Add(newNotary);
         db.SaveChanges();
         return(Mapper.Map <RegisterdNotaryCompany>(newNotary));
     }
 }
예제 #2
0
 public void Delete(int registerId)
 {
     using (DocumentManagementDB db = new DocumentManagementDB())
     {
         NotaryCompany newNotary = new NotaryCompany()
         {
             Id = registerId, Deleted = true
         };
         db.NotaryCompanies.Attach(newNotary);
         db.Entry(newNotary).Property(x => x.Deleted).IsModified = true;
         db.SaveChanges();
     }
 }
예제 #3
0
 public RegisterdNotaryCompany Update(UpdateNotaryCompany registroParaActualizar)
 {
     using (DocumentManagementDB db = new DocumentManagementDB())
     {
         NotaryCompany notaryToUpdate = Mapper.Map <NotaryCompany>(registroParaActualizar);
         db.NotaryCompanies.Attach(notaryToUpdate);
         db.Entry(notaryToUpdate).Property(x => x.Email).IsModified      = true;
         db.Entry(notaryToUpdate).Property(x => x.Address).IsModified    = true;
         db.Entry(notaryToUpdate).Property(x => x.Phone).IsModified      = true;
         db.Entry(notaryToUpdate).Property(x => x.Department).IsModified = true;
         db.Entry(notaryToUpdate).Property(x => x.District).IsModified   = true;
         db.Entry(notaryToUpdate).Property(x => x.Province).IsModified   = true;
         db.SaveChanges();
         return(Mapper.Map <RegisterdNotaryCompany>(notaryToUpdate));
     }
 }
 public void CreateCompany()
 {
     using (DocumentManagementDB db = new DocumentManagementDB())
     {
         NotaryCompany newNotaryCompany = new NotaryCompany()
         {
             Address                = "Av La Marina 750",
             Name                   = "Notaria Inicial",
             Department             = "Callao",
             Province               = "Callao",
             District               = "La Perla",
             Email                  = "*****@*****.**",
             Phone                  = "980784506",
             RUC                    = "10700078006",
             SunatsRegistrationDate = DateTime.Now
         };
         db.NotaryCompanies.Add(newNotaryCompany);
         db.SaveChanges();
     }
 }