Beispiel #1
0
        public async Task <ActionResult> DeleteConfirmed(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var applicationgroup = await GroupManager.FindByIdAsync(id);

            await GroupManager.DeleteGroupAsync(id);

            var url = Url.Action("Index", "Groups");

            return(Json(new { success = true, url }));
        }
Beispiel #2
0
        public async Task <ActionResult> Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ApplicationGroup applicationgroup = db.ApplicationGroups.Find(id);

            if (applicationgroup != null)
            {
                var result = await GroupManager.DeleteGroupAsync(applicationgroup.Id);

                db.SaveChanges();
                if (!result.Succeeded)
                {
                    ModelState.AddModelError("", result.Errors.First());
                    return(View());
                }
            }
            return(RedirectToAction("Index"));
        }