示例#1
0
        public ActionResult GridViewSpecialityPartialUpdate(Database.Speciality item)
        {
            var model = dbSpecialities.Specialities;

            if (ModelState.IsValid)
            {
                try
                {
                    var modelItem = model.FirstOrDefault(it => it.id == item.id);
                    if (modelItem != null)
                    {
                        this.UpdateModel(modelItem);
                        dbSpecialities.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            var model1 = dbSpecialities.Specialities.ToList().Where(x => x.UserId == MySession.Current.UserGuid);

            return(PartialView("_GridViewSpecialityPartial", model1.ToList()));
        }
示例#2
0
        public ActionResult GridViewSpecialityPartialAddNew(Database.Speciality item)
        {
            var model = dbSpecialities.Specialities;

            if (ModelState.IsValid)
            {
                try
                {
                    item.UserId = MySession.Current.UserGuid;
                    model.Add(item);
                    dbSpecialities.SaveChanges();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            var model1 = dbSpecialities.Specialities.ToList().Where(x => x.UserId == MySession.Current.UserGuid);

            return(PartialView("_GridViewSpecialityPartial", model1.ToList()));
        }