Beispiel #1
0
        //Category logic
        public static LibraryItemVM CleanCategory(LibraryItemVM model)
        {
            var category     = new Category();
            var tempCategory = CategoryProcessor.GetCategoryByName(model.CategoryName);

            category.CategoryName = tempCategory.CategoryName;
            category.Id           = tempCategory.Id;
            model.Category        = category;
            return(model);
        }
Beispiel #2
0
        public static LibraryItemModel MappToLibraryItemModelFromVM(LibraryItemVM item)
        {
            var model = new LibraryItemModel();

            var category = CategoryProcessor.GetCategoryByName(item.Category.CategoryName);

            model.Author         = item.Author;
            model.BorrowDate     = item.BorrowDate;
            model.Borrower       = item.Borrower;
            model.CategoryId     = category.Id;
            model.Id             = item.Id;
            model.IsBorrowable   = item.IsBorrowable;
            model.Pages          = item.Pages;
            model.RunTimeMinutes = item.RunTimeMinutes;
            model.Title          = item.Title;
            model.Type           = item.Type;

            return(model);
        }