예제 #1
0
        // 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);
        }
예제 #2
0
        private CatagoryService CreateCatagoryService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new CatagoryService(userId);

            return(service);
        }
예제 #3
0
 public CatagoryController(ApplicationDbContext dbContext, IDataProtectionProvider dataProtectionProvider,
                           IConfiguration configuration)
 {
     catagoryService     = new CatagoryService(dbContext);
     fileUploadService   = new FileUploadService();
     _protector          = dataProtectionProvider.CreateProtector("");
     azureStorageService = new AzureStorageService(configuration);
 }
예제 #4
0
        //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());
        }
예제 #5
0
        // GET: Note
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new CatagoryService(userId);
            var model   = service.GetCatagory();

            return(View(model));
        }
예제 #6
0
        //添加图书信息
        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);
        }
예제 #7
0
 public CatagoryApiController()
 {
     unitOfWork = new AlpsContext();
     catagoryService = new CatagoryService(unitOfWork);
 }
예제 #8
0
 //添加图书分类
 public static Catagory  AddCategory(Catagory ca)
 {
     return(CatagoryService.AddCategory(ca));
 }
예제 #9
0
 //查询图书类别
 public static IList <Catagory> GetCatagoryAll()
 {
     return(CatagoryService.GetCatagoryAll());
 }