Пример #1
0
        public void UpdateCategory(Model.Category category, int categoryId)
        {
            var tableCategory = context.Categorys.Find(categoryId);

            tableCategory.name        = category.Name;
            tableCategory.category_id = category.CategoryId;
            context.SaveChanges();
        }
Пример #2
0
        public static Table.Category Map(this Model.Category category)
        {
            var tableCategory = new Table.Category
            {
                name = category.Name
            };

            return(tableCategory);
        }
Пример #3
0
        public static Model.Category Map(this Table.Category category, int filmCount = 0)
        {
            var domainCategory = new Model.Category
            {
                CategoryId = category.category_id,
                FilmCount  = filmCount,
                Name       = category.name,
                lastUpdate = category.last_update
            };

            return(domainCategory);
        }
Пример #4
0
        public static Model.Category Map(this Table.Category category, int filmCount = 0)
        {
            var domainCategory = new Model.Category
            {
                CategoryId = category.category_id,
                FilmCount = filmCount,
                Name = category.name,
                lastUpdate = category.last_update
            };

            return domainCategory;
        }
Пример #5
0
 public void AddCategory(Model.Category category)
 {
     context.Categorys.Add(category.Map());
 }