Пример #1
0
        public async Task <IActionResult> Edit(Faculty f)
        {
            var editFaculty = await _faculty.Update(f);

            if (editFaculty && ModelState.IsValid)
            {
                Alert("Faculty Edited successfully.", NotificationType.success);
                return(RedirectToAction("Index"));
            }
            else
            {
                Alert("faculty not Edited!", NotificationType.error);
            }
            return(View());
        }
Пример #2
0
        public async Task <IActionResult> Edit(Faculty faculty)
        {
            //var editFaculty = await _faculty.GetById(id);
            var editFaculty = await _faculty.Update(faculty);


            if (editFaculty && ModelState.IsValid)
            {
                //    editFaculty.Name = faculty.Name;
                //    context.SaveChanges();
                Alert("Faculty edited successfully!", NotificationType.success);
                return(RedirectToAction("Index"));
                //return RedirectToAction("Details", new { id = editFaculty.Id });
            }
            Alert("Faculty not edited!", NotificationType.warning);
            return(View());
        }
 public IActionResult OnPost()
 {
     if (!ModelState.IsValid)
     {
         return(Page());
     }
     else
     {
         if (CreateObj.Id != 0)
         {
             _facultyRepo.Update(CreateObj);
         }
         else
         {
             _facultyRepo.Add(CreateObj);
         }
         _facultyRepo.Save();
         return(RedirectToPage("./Index"));
     }
 }