예제 #1
0
 public virtual void Delete(SupportTeamViewModel model, ModelStateDictionary modelState)
 {
     var entity = model.ToEntity();
     db.SupportTeams.Attach(entity);
     // TODO: here should verify the room id is not in the meeting tables
     db.SupportTeams.Remove(entity);
     db.SaveChanges();
 }
예제 #2
0
        public JsonResult EditingPopup_Destroy([DataSourceRequest] DataSourceRequest request, SupportTeamViewModel rvm)
        {
            if (rvm != null)
            {
                service.Delete(rvm, ModelState);
            }

            return Json(new[] { rvm }.ToDataSourceResult(request, ModelState));
        }
예제 #3
0
        public JsonResult EditingPopup_Create([DataSourceRequest] DataSourceRequest request, SupportTeamViewModel rvm)
        {
            if (rvm != null && ModelState.IsValid)
            {
                service.Insert(rvm, ModelState);
            }

            return Json(new[] { rvm }.ToDataSourceResult(request, ModelState));
        }
예제 #4
0
        public virtual void Update(SupportTeamViewModel model, ModelStateDictionary modelState)
        {
            if (ValidateModel(model, modelState))
            {
                if (string.IsNullOrEmpty(model.Text))
                {
                    model.Text = "";
                }

                if (model.Value < 0)
                {
                    model.Value = 100;
                }

                var entity = model.ToEntity();
                db.SupportTeams.Attach(entity);

                db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
        }
예제 #5
0
        public virtual void Insert(SupportTeamViewModel model, ModelStateDictionary modelState)
        {
            if (ValidateModel(model, modelState))
            {
                if (string.IsNullOrEmpty(model.Text))
                {
                    model.Text = "";
                }

                if (model.Value < 0)
                {
                    model.Value = 100;
                }

                var entity = model.ToEntity();

                db.SupportTeams.Add(entity);
                db.SaveChanges();

                model.ID = entity.ID;
            }
        }
예제 #6
0
        private bool ValidateModel(SupportTeamViewModel room, ModelStateDictionary modelState)
        {
            //if (appointment.Start > appointment.End)
            //{
            //    modelState.AddModelError("errors", "End date must be greater or equal to Start date.");
            //    return false;
            //}

            return true;
        }