ASSIGNMENT 2 FRONT SHEET Qualification BTEC Level 5 HND Diploma in Business Unit number and title Unit 30: Application Development Submission date Date Received 1stsubmission Re-submission Date Date Received 2ndsubmission Student Name Nguyen Huu Hoang Khanh Student ID GCD220223 Class GCD1102 Assessor name Pham Thanh Son Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I unde making a false declaration is a form of malpractice. Student’s signature Grading grid P4 P5 P6 M3 M4 M5 D2 D3 Summative Feedback: ResubmissionFeedback: Grade: Assessor Signature: Date: Internal Verifier’s Comments: Signature & Date: Table of Contents I. Chapter 1: Peer Review and Feedback Analysis (P4).
Format questionnaire to reviews the business application, problem definition statement, proposed solution and development strategy. Collect review feedbacks. Chapter 2: Application Development (P5). Folder structure of the application.
Source code samples of the application. Final screenshots of the application. Chapter 3: Application Evaluation (P6). Review the performance of the application.
44 Table of Figures Figure 1: Questionnaire about the business application (1). Figure 2: Questionnaire about the business application (2). Figure 3: Questionnaire about the business application (3). Figure 4: Folder structure.
Figure 5: Customer Role (1). Figure 6: Customer Role (2). Figure 7: Customer Role (3). Table of Tables Table 1: The result of survey.
Chapter 1: Peer Review and Feedback Analysis (P4) 1. Format questionnaire to reviews the business application, problem definition statement, proposed solution and development strategy. We've devised an online survey aimed at gathering user feedback post-launch, focusing on their liv experience with the website. This survey serves to pinpoint any encountered navigational challenges a solicit recommendations for enhancing the user experience.
The survey will cover aspects such as website layout, functionality, and overall user satisfaction, employin uncomplicated questions accessible to all visitors. Our goal is to gather user insights to enhance the website's user-friendliness. All comments received will b carefully reviewed and factored into future updates or improvements. Our primary objective is to ensure a seamless user experience, striving to identify issues and impleme necessary improvements through this questionnaire.
Figure 1: Questionnaire about the business application (1) Figure 2: Questionnaire about the business application (2) Figure 3: Questionnaire about the business application (3) 2. Collect review feedbacks The result of Survey: No Question Proposed Answer One of the following: Is it realistic for us to not show every product on the fron 1 1. No One of the following: How probable is it that you will share your app with 1. Very likely 2 friends? 2.
May be One of the following: 3 Do you enjoy the user interface of our website? 1. No One of the following: 1. A few seconds 4 How fast does our payment usually take? 2. More than one minute 4.
Not clear One of the following: Does our registration system work properly and provide 1. Yes 5 correct page when logged in? 2. No One of the following: What is the typical time it takes for a webpage to fully 1. A few seconds 6 load? 2.
More than a minute 7 Rate our system from 1 to 10 A selection from 1 to 10 Table 1: The result of survey Feedback: After collating feedback from our colleagues and authorized individuals who have interacted with or been given permission to use our products, the rating for each response stands as follows: No Question Proposed Answer Is it realistic for us to not show every product on the fro 76.2% of our feedback choose Ye 1 23.8% of our feedback choose N page? 35.7% of our feedback choose Very likely 31% of our feedback choose Not How probable is it that you will share your app with likely 2 friends? 33.3% of our feedback choose May be 78.6% of our feedback choose Ye 3 Do you enjoy the user interface of our website? 21.4% of our feedback choose N 47.6% of our feedback choose A few seconds 21.4% of our feedback choose O minute 4 How fast does our payment usually take? 21.4% of our feedback choose More than one minute 9.5% of our feedback choose No clear Does our registration system work properly and provid 83.3% of our feedback choose Ye 5 16.7% of our feedback choose N the correct page when logged in? 61.9% of our feedback choose A few seconds 23.8% of our feedback choose What is the typical time it takes for a webpage to fully 6 About a minute load? 14.3% of our feedback choose More than a minute 26.2% of our feedback choose 10 23.8% of our feedback choose 9 21.4% of our feedback choose 8 7 Rate our system from 1 to 10 14.3% of our feedback choose 7 9.5% of our feedback choose 6 4.8% of our feedback choose 5 Table 2: Feedback II. Chapter 2: Application Development (P5) 1. Folder structure of the application Figure 4: Folder structure To access the configuration file for the login and registration page, examine the Areas folder. Here are the designated locations for various components within the application: g p pp - The Controllers directory will accommodate all controller classes intended for the application's management and operation.
- Within the Data directory, the ApplicationDbContext file assumes responsibility for the creation and maintenance of the database. - The Models directory is specifically allocated for housing all models utilized throughout the application's functionality. - The Utils directory is designated to house constant values corresponding to each distinct user role - The ViewModels directory is dedicated to preserving models that contain requisite data for displaying pertinent application information. Source code samples of the application Customer Role: Upon the initial login by the user, the homepage will integrate a specialized function expressly crafted to exhibit information concerning the availability of books.
This functionality will showcase an extensive inventory comprising all available books, thereby facilitating customers' effortless selection processes. public async Task<IActionResult> BookProduct() { var book = await context.ToListAsync(); return View(book); } public async Task<IActionResult> BookProductDetail(int id) { var book = await context.BookId == id); ViewBag.Category_id = new SelectList(context.Categories, "CategoryId", "Name"); ViewBag.Company_id = new SelectList(context.PublicCompanies, "PublishingCompanyId", "Name"); if (book != null) { var viewmodel = new Book() { BookId = book.BookId, Name = book.Name, Quantity = book.Quantity, Price = book.Price, Description = book.Description, UpdateDate = book.UpdateDate, Author = book.Author, Image = book.Image, CategoryId = book.CategoryId, PublishCompanyId = book.PublishCompanyId }; return await Task.Run(() => View("BookProductDetail", viewmodel)); } return RedirectToAction("BookProduct"); } Figure 5: Customer Role (1) The described function empowers clients to incorporate desired books into their basket, wherein th selected items within the cart are securely stored within individual customer accounts. public async Task<IActionResult> AddToCart(int id) { var book = await context.BookId == id); if (book != null) { var cart_item = new Cart() { BookId = book.BookId, Book = book, Quantity = 1 }; cart_item.Total = cart_item.Quantity * cart_item.Price; foreach (var item in context.ToList()) { if (item.BookId == cart_item.BookId) { return RedirectToAction("CartIndex"); } } await context.AddAsync(cart_item); await context.Sleep(2500); return RedirectToAction("BookProduct", "Book"); } } return RedirectToAction("CartIndex"); } Figure 6: Customer Role (2) The presented feature facilitates customers in transitioning selected books from their basket to the Order list, enabling a seamless status change. The items within the Order list will align with the specific accounts of individual customers.
public async Task<IActionResult> OrderBook() { var identity = (ClaimsIdentity)User.Identity; var claims = identity.NameIdentifier); var user = await context.Value); var customer = new Customer() { UserId = user.Id, Name = user.FullName, Email = user.Email, Address = user.Address, User = user }; if (!context.Contains(customer)) { await context.AddAsync(customer); await context.SaveChangesAsync(); } var order = new Order() { UserId = user.Id }; await context.AddAsync(order); await context.SaveChangesAsync(); var order_list = await context.ToListAsync(); foreach (var book in order_list) { { var book_object = await context.BookId); var orderDetail = new OrderDetail() { Quantity = book.Quantity, BookId = book.BookId, OrderId = order.OrderId, Book = book_object.Book, Total = book.Total }; await context.AddAsync(orderDetail); await context.Remove(book); await context.SaveChangesAsync(); } foreach (var order_book in order_list) { var stored_book = await context.BookId == order_book.BookId); int book_quantity_inStored = stored_book.Quantity; book_quantity_inStored -= order_book.Quantity; stored_book.Quantity = book_quantity_inStored; if (stored_book.Remove(stored_book); } await context.SaveChangesAsync(); } await context.SaveChangesAsync(); return RedirectToAction("BookProduct", "Book"); } Figure 7: Customer Role (3) Store Owner Role: o Category: Below is a function that allows StoreOwner to display category information [HttpGet] [ p ] public async Task<IActionResult> CategoryApproved() { var category = await context.ToListAsync(); return View(category); } Figure 8: Category (1) The feature enabling the Store Owner to generate a new category is outlined below. Upon the establishment of this category, the system will trigger a notification to the administrator, informing them of the newly created category. public async Task<IActionResult> CreateCategory(AddCategoryViewModel CategoryModel) { var category = new Category() { Name = CategoryModel.Name, Description = CategoryModel.Description }; await context.AddAsync(category); await context.SaveChangesAsync(); return RedirectToAction("CategoryIndex"); } Figure 9: Category (2) The following function grants the StoreOwner the capability to modify category details. [HttpGet] public async Task<IActionResult> ViewCategory(int id) { var category = await context.CategoryId == id); if (category != null) { var viewmodel = new UpdateCategoryView() { CategoryId = category.CategoryId, Name = category.Name, Description = category.Description }; return await Task.Run(() => View("ViewCategory", viewmodel)); //truyền đối tượng viewmodel } return RedirectToAction("CategoryIndex"); } Figure 10: Category (3) Here is a function that grants the StoreOwner the ability to remove category information.
[HttpPost] public async Task<IActionResult> DeleteCategory(UpdateCategoryView model) //tham số { var category = await context.CategoryId); if (category != null) { context.Remove(category); await context.SaveChangesAsync(); return RedirectToAction("CategoryIndex"); } return RedirectToAction("CategoryIndex"); } Figure 11: Category (4) o Publishing Company: The function provided below facilitates the StoreOwner in accessing and displaying Publishing Company information within the system. [HttpGet] public async Task<IActionResult> CompanyIndex() { var company = await context.ToListAsync(); return View(company); } Figure 12: PublishCompany (1) The function illustrating the capability for the Store Owner to create a new Publishing Company is outlined below.Name, Adress = CompanyModel.Adress, }; await context.AddAsync(company); await context.SaveChangesAsync(); return RedirectToAction("CompanyIndex"); } Figure 13: PulishingCompany (2) Here's a function enabling the StoreOwner to modify Publishing Company information. [HttpPost] public async Task<IActionResult> ViewCompany(UpdateCompany model) { var company = await context.PublishingCompanyId); if (company != null) { company.Adress; await context.SaveChangesAsync(); return RedirectToAction("CompanyIndex"); } return RedirectToAction("CompanyIndex"); } Figure 14: PublishCompany (3) The function described below enables the StoreOwner to remove Publishing Company information. [HttpPost] public async Task<IActionResult> DeleteCompany(UpdateCompany model) { var company = await context.PublishingCompanyId); if (company != null) { context.Remove(company); await context.SaveChangesAsync(); return RedirectToAction("CompanyIndex"); } return RedirectToAction("CompanyIndex"); } Figure 15: PublishCompany (4) o Book: The following function enables the StoreOwner to access and exhibit information regarding books available within the system.
[HttpGet] public async Task<IActionResult> BookIndex() { var book = await context.ToListAsync(); return View(book); } Figure 16: Book (1) The function presented below empowers the StoreOwner to generate new information entries for books within the system. public async Task<IActionResult> CreateBook(AddBookViewModel BookModel) { ViewBag.Category_id = new SelectList(context.Categories, "CategoryId", "Name", BookModel.Company_id = new SelectList(context.PublicCompanies, "PublishingCompanyId", "Name", BookModel.PublishCompanyId); string uniqueFileName = UploadedFile(BookModel); var book = new Book() { //lay các thuộc tính ra Name = BookModel.Name, Quantity = BookModel.Quantity, Price = BookModel.Price, Description = BookModel.Description, UpdateDate = BookModel.UpdateDate, Author = BookModel.Author, Image = uniqueFileName, FronImage = BookModel.FronImage, CategoryId = BookModel.CategoryId, PublishCompanyId = BookModel.PublishCompanyId, Category = BookModel.Category, PublishCompany = BookModel.PublishCompany }; foreach (var bookitem in context.ToList()) { if (book.Name) { var NewQuantity = bookitem.ToString(); var StoredQuantity = book.ToString(); int ToStoredQuantity = int.Parse(NewQuantity); //số lượng sách bookitem.Quantity = ToStoredQuantity; bookitem.UpdateDate; await context.Attach(book); //đính kèm context.Added; await context.AddAsync(book); await context.SaveChangesAsync(); return RedirectToAction("BookIndex"); } Figure 17: Book (2) The provided function grants the StoreOwner the capability to modify existing book information within the system. public async Task<IActionResult> ViewBook(UpdateBookView model) { ViewBag.Category_id = new SelectList(context.Categories, "CategoryId", "Name", model.Company_id = new SelectList(context.PublicCompanies, "PublishingCompanyId", g p y_ ( p g p y "Name", model.PublishCompanyId);//render du lieu ra view var book = await context.BookId); string change_img = UploadedFile(model); if (book != null) { book.Author; if (change_img != null) { book.Image = change_img; } book.PublishCompanyId; await context.SaveChangesAsync(); } else { return NotFound("Book Not Found"); } await context.