public async Task <IActionResult> DeleteGroup([FromBody] GroupViewModel model) { try { if (ModelState.IsValid) { Group group = new Group() { Name = model.Name, CaptainId = model.CaptainId, GroupType = model.GroupType, CreatedAt = DateTime.Now, CreatedBy = model.CreatedBy, UpdatedAt = model.UpdateddAt, UpdatedBy = model.UpdatedBy }; await _groupManager.DeleteGroup(group); return(Ok(ApiResponse(ApiResponseStatus.Success, group, $@"Group successfully deleted."))); } return(BadRequest(ApiResponse(ApiResponseStatus.Fail, GetModelStateErrors(ModelState), "Model validation failure."))); } catch (Exception e) { _logger.LogError(e.Message); return(HandleException("1", e, "An error occurred while deleting record. Please try again later.")); } }
public void DeleteGroup() { Assert.IsTrue(Groups.AddGroup("test1", "heal") != ""); Assert.IsTrue(Groups.GroupExists("test1")); Assert.IsTrue(Groups.DeleteGroup("test1") != ""); Assert.IsFalse(Groups.GroupExists("test1")); }
internal void DeleteGroup(ConnectionGroupModel group) { MessageBoxResult result = MessageBox.Show($"Are you sure you want to delete '{group.GroupName}'?", "Delete group?", MessageBoxButton.YesNo); if (MainWindowModel.Groups.Contains(group) && result == MessageBoxResult.Yes) { MainWindowModel.Groups.Remove(group); GroupManager.DeleteGroup(group); ChangeSelectedGroup(); } }
public long DeleteGroup(long groupId) { try { return(_groupManager.DeleteGroup(groupId)); } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
public HttpResponseMessage DeleteGroupApi(int id) { try { groupManager.DeleteGroup(id); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.ToString())); } return(Request.CreateResponse(HttpStatusCode.OK)); }
private void btnGrDel_Click(object sender, EventArgs e) { int curRowId = Convert.ToInt32(grdGroups.CurrentRow.Cells[0].Value); if (grdGroups.DataSource == null) { return; } gr.DeleteGroup(curRowId); grdGroups.DataSource = gr.GetGroups().ToList(); setcmbStudGroup(); setcmbGrSbjGroup(); }
public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var group = GroupManager.FindById(id); if (group == null) { return(HttpNotFound()); } GroupManager.DeleteGroup(id); return(RedirectToAction("Index")); }
public IHttpActionResult DeleteGroup(int id) { var paths = ImageManager.GetImagePathsByGroup(id); string workingFolder = HttpRuntime.AppDomainAppPath + @"\Images"; GroupManager.DeleteGroup(id, User.Identity.GetUserId()); foreach (var path in paths) { File.Delete(Path.Combine(workingFolder, path)); } PiChatHub.SendDeleteGroupNotification(id); return(Ok()); }
public void DeleteGroupTest() { var expectedCount = groupManager.GetGroups().Count(); var expectedGroup = groupManager.GetGroups().Last(); var expectedId = expectedGroup.Id; groupManager.DeleteGroup(expectedId); var actuaList = groupManager.GetGroups(); var actualCount = actuaList.Count(); Assert.AreEqual(expectedCount - 1, actualCount, "deleted from DB not one value. Its" + (expectedCount - actualCount).ToString()); foreach (var item in actuaList) { Assert.AreNotEqual(expectedId, item.Id, "DB do not delete item with id: " + expectedId.ToString()); } }
public bool DeleteGroup(int id) { return(groupManager.DeleteGroup(id)); }
public ActionResult DeleteConfirmed(int id) { gm.DeleteGroup(id); return(RedirectToAction("Index")); }