public MeetingViewModel(int meetingID, DateTime time, string description, string place, CategoryViewModel category, List<ContactViewModel> contacts)
 {
     this.MeetingID = meetingID;
     this.Time = time;
     this.Description = description;
     this.Place = place;
     this.Category = category;
     this.ContactModels = new List<ContactViewModel>(contacts);
 }
 public ActionResult Edit(CategoryViewModel categoryModel)
 {
     if (ModelState.IsValid)
     {
         Category category = categoryModel.ToCategory();
         repository.InsertOrUpdate(category, User.Identity.Name);
         repository.Save();
         return RedirectToAction("Index");
     }
     return View(categoryModel);
 }
 public ActionResult Edit(int id)
 {
     Category category = repository.Get(id);
     CategoryViewModel categoryModel = new CategoryViewModel(category);
     return View(categoryModel);
 }
        public Meeting ToMeeting()
        {
            Meeting meeting = new Meeting();

            CategoryViewModel categoryModel = new CategoryViewModel();
            categoryModel = this.Category;
            Category category = new Category();
            if (this.Category == null)
            {
                meeting.CategoryID = null;
            }
            else
            {
                category = categoryModel.ToCategory();
                meeting.CategoryID = category.CategoryID;
            }

            meeting.MeetingID = this.MeetingID;
            meeting.Time = this.Time;
            meeting.Description = this.Description;
            meeting.Place = this.Place;

            return meeting;
        }