// Helper Method private CatagoryService CreateCatagoryService() { var userId = Guid.Parse(User.Identity.GetUserId()); // this needs to be in each model that calls for it? var service = new CatagoryService(userId); return(service); }
private CatagoryService CreateCatagoryService() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new CatagoryService(userId); return(service); }
public CatagoryController(ApplicationDbContext dbContext, IDataProtectionProvider dataProtectionProvider, IConfiguration configuration) { catagoryService = new CatagoryService(dbContext); fileUploadService = new FileUploadService(); _protector = dataProtectionProvider.CreateProtector(""); azureStorageService = new AzureStorageService(configuration); }
//Add method here VVVV //GET public ActionResult Create() { var userId = Guid.Parse(User.Identity.GetUserId()); CatagoryService service = new CatagoryService(userId); ViewBag.Catagories = service.GetCatagory(); return(View()); }
// GET: Note public ActionResult Index() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new CatagoryService(userId); var model = service.GetCatagory(); return(View(model)); }
//添加图书信息 public static void AddBook(string Title, string Author, string AurhorDescription, string ContentDescription, string ISBN, string EditorComment, string TOC, int publisherid, int WordsCount, decimal UnitPrice, DateTime PublishDate) { Books book = new Books(); book.Catagorys = CatagoryService.GetCatagoryById(1); book.Title = Title; book.Author = Author; book.ISBN = ISBN; book.UnitPrice = UnitPrice; book.TOC = TOC; book.Publisher = PublisherService.GetPublishersById(publisherid); book.WordsCount = WordsCount; book.AurhorDescription = AurhorDescription; book.PublishDate = PublishDate; book.ContentDescription = ContentDescription; book.EditorComment = EditorComment; book.Clicks = 0; BookService.AddBook(book); }
public CatagoryApiController() { unitOfWork = new AlpsContext(); catagoryService = new CatagoryService(unitOfWork); }
//添加图书分类 public static Catagory AddCategory(Catagory ca) { return(CatagoryService.AddCategory(ca)); }
//查询图书类别 public static IList <Catagory> GetCatagoryAll() { return(CatagoryService.GetCatagoryAll()); }