public async Task <IActionResult> kickClassMember(int userid, int classid) { _repo.Delete(await _repo.GetClassMemberRelation(userid, classid)); if (await _repo.Save()) { return(Ok("Member kicked from your class successfully !")); } throw new Exception("ERROR, Problem occured while kicking member from your class"); }
public async Task <IActionResult> deleteUser(int id) { var user = await _userManager.Users.FirstOrDefaultAsync(u => u.Id == id); var classes = await _repo.GetClasses(user.Id); foreach (var c in classes) { _repo.Delete(c); } _repo.Delete(user); await _repo.Save(); return(Ok("Deleted " + user.FName + " " + user.LName + " Successfully !")); }
public async Task <IActionResult> DeletePublication(int pubid) { var pub = await _repo.GetPublication(pubid); var attachments = await _repo.GetAttachments(pubid); foreach (var att in attachments) { string filename = _env.ContentRootPath + "/" + att.path; System.IO.File.Delete(filename); _repo.Delete(att); } _repo.Delete(pub); if (await _repo.Save()) { return(Ok("Publication Deleted successfully !")); } throw new Exception("ERROR, Problem occured while deleting the publication"); }
public async Task <IActionResult> DeletePublication(int comid) { var com = await _repo.GetComment(comid); _repo.Delete(com); if (await _repo.Save()) { return(Ok("Comment Deleted successfully !")); } throw new Exception("ERROR, Problem occured while deleting the Comment"); }
public async Task <IActionResult> Delete([FromBody] attachmentdata att) { var at = await _repo.GetAttachment(att.fileid); _repo.Delete(at); if (await _repo.Save()) { string filename = _env.ContentRootPath + "/" + att.filepath; System.IO.File.Delete(filename); return(Ok("File Deleted Successfully")); } throw new Exception("ERROR, Problem occured while deleting the attachment"); }