public long Save(Category updated) { using (var work = _unitOfWork.Begin()) { if (updated.IsNew()) { _repo.Add(updated); work.Complete(); return updated.Id; } var existing = _repo.Get<Category>(updated.Id); existing.Name = updated.Name; work.Complete(); return existing.Id; } }
public virtual void AddCategory(Category category) { category.Movies.Add(this); Categories.Add(category); }
public CategoryViewModel(Category category) { Category = category; }