예제 #1
0
        public async Task <PartialViewResult> EditCollege([Bind(Include = "Id,Name,Title")] EditViewModel model)
        {
            if (ModelState.IsValid)
            {
                College college = await _collegeService.GetByIdAsync(model.Id);

                if (college != null)
                {
                    college.Title = model.Title;
                    college.Name  = model.Name;
                    await _collegeService.UpdateAsync(college);

                    return(null);
                }
                else
                {
                    ModelState.AddModelError("", "The College wasn't found");
                }
            }
            ViewBag.currentAction = "EditCollege";
            return(PartialView("EditModel", model));
        }