public void Insert(Members Member) { try { #region Creating the Object Members User = new Members { MemberId = Member.MemberId, MemberName = Member.MemberName, MemberSurname = Member.MemberSurname, EmailAddress = Member.EmailAddress, ContactNumber = Member.ContactNumber, Gender = Member.Gender, IsActive = Member.IsActive }; var EmailAddress = Member.EmailAddress; var Password = "******"; #endregion IdentityHelper.AddIdentityUser(EmailAddress, Password); MemberRepo.Insert(User); MemberRepo.Save(); } catch (Exception e) { Error.InsertError(e); } }
public void InsertBook(Book bookEntity) { try { Book BookRepoEntity = new Book { BookTitle = bookEntity.BookTitle, BookDescription = bookEntity.BookDescription, ISBN = bookEntity.ISBN, Author = bookEntity.Author, Edition = bookEntity.Edition, Language = bookEntity.Language, MemberId = GlobalIXHelper.GetMemberId(), PublishedDate = DateTime.Parse(DateTime.Now.ToLongDateString()), DaysAvailable = ReturnDaysAvailable(bookEntity), IsBookActive = true, }; BookRepo.Insert(BookRepoEntity); BookRepo.Save(); } catch (Exception ex) { Error.InsertError(ex); } }
public void InsertReview(BookReview bookReview) { try { bookReviewRepo.Insert(bookReview); bookReviewRepo.Save(); } catch (Exception ex) { Error.InsertError(ex); } }
public void EnableUserAccess(UserAccessTable AccessTable) { try { var userName = from a in dbContext.Members join b in dbContext.AspNetUsers on a.EmailAddress equals b.Email join c in dbContext.UserAccessTables on b.Id equals c.UserGuidId select a.MemberName; UserAccessTable table = new UserAccessTable { UserGuidId = AccessTable.UserGuidId, RoleGuidId = AccessTable.RoleGuidId, DateEnrolled = DateTime.Now, UserName = "******", FunctionId = -999, UserRevoked = false }; IdentityHelper.AddUserToRole(table.UserGuidId, table.RoleGuidId); dbContext.UserAccessTables.Add(table); dbContext.SaveChanges(); } catch (Exception userException) { Error.InsertError(userException); } }
public void InsertRating(BookRating bookRating) { try { BookRating bookrating = new BookRating { RatingNumber = bookRating.RatingNumber, MemberId = GlobalIXHelper.GetMemberId(), BookId = bookRating.BookId }; bookRatingRepo.Insert(bookrating); bookRatingRepo.Save(); } catch (Exception ex) { Error.InsertError(ex); } }
public void InsertPermission(Permission UserPermission) { try { Guid RandomGuid = Guid.NewGuid(); Permission permit = new Permission { UserGuid = RandomGuid.ToString(), UserRole = UserPermission.UserRole, UserRoleId = -999, DateEnrolled = DateTime.Now, MemberEnrolled = "Nick" }; IdentityHelper.CreateUserPermission(permit.UserRole, permit.UserGuid); PermissionRepo.Insert(permit); PermissionRepo.Save(); } catch (Exception ex) { Error.InsertError(ex); } }