/// <summary> /// Create a new user /// </summary> /// <param name="role"></param> /// <param name="objContex"></param> public static void Insert(UserDto userDto, ModelUnibookContainer objContex) { try { User user = new User(); user.Email = userDto.Email; user.Role = RoleBrl.Get(userDto.Role.RoleId, objContex); user.Person = PersonBrl.Get(userDto.Person.PersonId, objContex); user.Deleted = userDto.Deleted; PasswordDto password = userDto.Password; UserDal.Insert(user, password, objContex); } catch (Exception ex) { throw ex; } }
/// <summary> /// Insert a contact /// </summary> /// <param name="contact">Object contact to insert</param> /// <param name="objContex">Get table to object</param> public static void Insert(ContactDto contactDto, ModelUnibookContainer objContex) { try { Contact contact = new Contact(); contact.ContactId = contactDto.ContactId; contact.Data = contactDto.Data; contact.Description = contactDto.Description; contact.Person = PersonBrl.Get(contactDto.Person.PersonId, objContex); ContactDal.Insert(contact, objContex); } catch (DbEntityValidationException ex) { throw ex; } catch (Exception ex) { throw ex; } }
/// <summary> /// Update a contact /// </summary> /// <param name="objContex">Get table to object</param> public static void Update(ContactDto contactDto, ModelUnibookContainer objContex) { try { Contact contact = ContactDal.Get(contactDto.ContactId, objContex); contact.Data = contactDto.Data; contact.Description = contactDto.Description; contact.Deleted = contactDto.Deleted; contact.Person = PersonBrl.Get(contactDto.Person.PersonId, objContex); ContactDal.Update(objContex); } catch (DbEntityValidationException ex) { throw ex; } catch (Exception ex) { throw ex; } }