public static Domain.Entities.Document.User ToUserDocumentFromEntity(this Domain.Entities.Entity.User userModel) { return(userModel != null ? new Domain.Entities.Document.User { Id = userModel.Id, FirstName = userModel.FirstName, MiddleName = userModel.MiddleName, LastName = userModel.LastName, Author = userModel.Author, ArticleType = userModel.ArticleType, RegistrationDate = userModel.RegistrationDate, EditingAssignments = userModel.EditingAssignments, ReviewAssignments = userModel.ReviewAssignments, Submission = userModel.Submission, Place = userModel.Place, Email = userModel.Email, EditingAssignmentsCurrent = userModel.EditingAssignmentsCurrent, EditingAssignmentsCompleted = userModel.EditingAssignmentsCompleted, ReviewAssignmentsCurrent = userModel.ReviewAssignmentsCurrent, ReviewAssignmentsEndosed = userModel.ReviewAssignmentsEndosed, ReviewAssignmentsRejected = userModel.ReviewAssignmentsRejected, SubmissionInReview = userModel.SubmissionInReview, SubmissionInitialValidation = userModel.SubmissionInitialValidation, SubmissionAccepted = userModel.SubmissionAccepted, SubmissionRejected = userModel.SubmissionRejected, BoardInvitations = userModel.BoardInvitations, BoardInvitationsPending = userModel.BoardInvitationsPending, BoardInvitationsAccepted = userModel.BoardInvitationsAccepted, BoardInvitationsDeclined = userModel.BoardInvitationsDeclined, BoardInvitationsRevoked = userModel.BoardInvitationsRevoked, BoardInvitationsRemoveFromBoard = userModel.BoardInvitationsRemoveFromBoard, } : null); }
public static Models.Login ToLogin(this Domain.Entities.Entity.User user, int userId) { return((user != null && userId > 0) ? new Models.Login { UserId = userId, Email = user.Email, Password = user.Password, UserType = Convert.ToInt32(UserRoles.RegisterdUser) } : null); }
public static Models.User ToUser(this Domain.Entities.Entity.User user) { return(user != null ? new Models.User { FirstName = user.FirstName, MiddleName = user.MiddleName, LastName = user.LastName, PhoneNumber = user.PhoneNumber, BirthDate = user.BirthDate, IsDeleted = false } : null); }
public bool Registration(Domain.Entities.Entity.User user) { try { if (!this.IsUserExist(user.Email)) { var userData = user.ToUser(); this.userDbContext.Users.Add(userData); this.userDbContext.SaveChanges(); this.userDbContext.Login.Add(user.ToLogin(userData.UserId)); this.userDbContext.SaveChanges(); return(true); } else { throw new ArgumentException("Email is already exists, plese try with another email!."); } } catch (Exception ex) { return(false); } }