예제 #1
0
 public ActionResult Edit(int id = 0)
 {
     var entity = _activityRepository.Entities.SingleOrDefault(x => x.ID == id);
     if (entity == null)
     {
         entity = new Activity();
     }
     if (id == 0)
     {
         entity.StartDate = DateTime.Now;
         entity.FinishDate = DateTime.Now.AddHours(2);
     }
     var viewModel = new ActivityViewModel();
     viewModel.Activity = entity;
     return View(viewModel);
 }
예제 #2
0
		private void detach_Activities(Activity entity)
		{
			this.SendPropertyChanging();
			entity.ActivityStatus = null;
		}
예제 #3
0
		private void attach_Activities(Activity entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}
예제 #4
0
 partial void DeleteActivity(Activity instance);
예제 #5
0
 partial void UpdateActivity(Activity instance);
예제 #6
0
 partial void InsertActivity(Activity instance);
예제 #7
0
        public ActionResult Remove(Activity model)
        {
            try
            {
                if (_activityRepository.Remove(model))
                {
                    return RedirectToAction("Grid", "ActivityGrid");
                }
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = ex.Message;
                return View(model);
            }

            ViewBag.ErrorMessage = "Не удалось удалить запись";
            return View(model);
        }