Example #1
0
 public bool CreateUser(User u, string loggingId)
 {
     try
     {
         if (RegexMatch.DoesUserMatch(u))
         {
             _unitOfWork.Users.Create(new Users
             {
                 AddressTable = new AddressTable
                 {
                     Postcode = u.Postcode,
                     City     = u.CityName,
                     Region   = u.Region.ToString(),
                 },
                 Logging_ID = loggingId,
                 Gender     = new Repository.DbConnection.Gender
                 {
                     Gender1 = u.Gender.ToString(),
                 },
                 PayPalMail  = u.PayPalMail,
                 FirstName   = u.FirstName,
                 LastName    = u.LastName,
                 AddressLine = u.AddressLine,
                 Description = u.Description,
             });
             return(true);
         }
         return(false);
     }
     catch (DuplicateKeyException)
     {
         return(false);
     }
 }
Example #2
0
 public bool EditUser(User u)
 {
     try
     {
         if (RegexMatch.DoesUserMatch(u))
         {
             _unitOfWork.Users.Update(new Users
             {
                 AddressTable = new AddressTable
                 {
                     Postcode = u.Postcode,
                     City     = u.CityName,
                     Region   = u.Region.ToString(),
                 },
                 AspNetUsers = new AspNetUsers
                 {
                     UserName    = u.UserName,
                     PhoneNumber = u.PhoneNumber,
                     Email       = u.Email,
                 },
                 Gender = new Repository.DbConnection.Gender
                 {
                     Gender1 = u.Gender.ToString(),
                 },
                 ID          = u.ID,
                 FirstName   = u.FirstName,
                 LastName    = u.LastName,
                 AddressLine = u.AddressLine,
                 PayPalMail  = u.PayPalMail,
                 LastUpdate  = u.LastUpdate
             });
             return(true);
         }
         return(false);
     }
     catch
     {
         return(false);
     }
 }