public virtual IActionResult DeleteManyConfirmed(long[] ids) { foreach (var id in ids) { if (_service.CanDelete(id)) { _service.Delete(id); } } return(RedirectToAction(nameof(Index))); }
/// <summary> /// Deletes the entity from the persistence infrastructure layer /// </summary> /// <param name="id">Id of the entity to be deleted</param> /// <returns>Id of the deleted item, 0 otherwise</returns> public virtual int Delete(int id) { try { // delete the entity matching from id in the database Tuple <bool, TModelEntity> result = _crudService.Delete(new object[] { id }); return(result.Item1 ? id : 0); } catch (Exception ex) { _logger.LogError(ex, Literals.p_ErrorDeletingDtoOfTypeX.ParseParameter(typeof(TDomainEntity).Name)); throw; } }
public async Task <bool> DeleteRole(Guid id) { return(await Task.Run(() => { return _rolesService.Delete(id); })); }
private async Task <Notification> EditInvoice(Invoice invoice, IdentityUser user) { try { _unitOfWork.BeginTransaction(); var record = await _invoiceCrudService.GetAsync(invoice.Id); record.IsTicket = invoice.IsTicket; record.ReferenceNo = invoice.ReferenceNo; record.Dr = invoice.Dr; record.FileCodeNo = invoice.FileCodeNo; record.Address = invoice.Address; record.ClientName = invoice.ClientName; record.Currency = invoice.Currency; record.PAX = invoice.PAX; record.Guide = invoice.Guide; record.Vehicle = invoice.Vehicle; record.TotalDue = invoice.TotalDue; record.Discount = invoice.Discount; record.NetAmount = invoice.NetAmount; record.ModifiedBy = user.Id; record.ModifiedDate = DateTime.Now; var invoiceDetails = _invoiceDetailCrudService.GetAll(p => p.InvoiceId == invoice.Id); foreach (InvoiceDetail invoiceDetail in invoiceDetails) { if (!invoice.InvoiceDetails.Any(x => x.Id == invoiceDetail.Id)) { _invoiceDetailCrudService.Delete(invoiceDetail); } } foreach (InvoiceDetail invoiceDetail in invoice.InvoiceDetails) { if (!invoiceDetails.Contains(invoiceDetail)) { await _invoiceDetailCrudService.InsertAsync(new InvoiceDetail { InvoiceId = invoice.Id, Particulars = invoiceDetail.Particulars, Amount = invoiceDetail.Amount, CreatedBy = user.Id }); } } _invoiceCrudService.Update(record); _unitOfWork.Commit(); return(new Notification("success", "Invoice updated successfully.")); } catch (Exception exception) { Console.WriteLine(exception.Message); _unitOfWork.Rollback(); return(new Notification("error", "Invoice update failed.")); } }
public HttpResponseMessage DeleteItem(int id) { var item = _itemService.Get(id); return(CreateResponseBuilder().WithCondition(() => UserIsAdmin) .WithMethod(() => _itemService.Delete(item))); }
public async Task <bool> DeleteAdmin(Guid id) { return(await Task.Run(() => { return _adminsService.Delete(id); })); }
public async Task <bool> DeleteClient(Guid id) { return(await Task.Run(() => { return _clientsService.Delete(id); })); }
public async Task <bool> DeleteElementGenericChore(Guid id) { return(await Task.Run(() => { return _elementGenericChoresService.Delete(id); })); }
public async Task <bool> DeleteBook(Guid id) { return(await Task.Run(() => { return _orderitemsService.Delete(id); })); }
public async Task <bool> DeleteInstallationUser(Guid id) { return(await Task.Run(() => { return _installationUsersService.Delete(id); })); }
public async Task <bool> DeleteGenericChoreFormatLabel(Guid id) { return(await Task.Run(() => { return _genericChoreFormatLabelsService.Delete(id); })); }
public virtual ActionResult Delete(dynamic id) { var dto = _service.GetByID(id); _service.Delete(dto); return(RedirectToAction("Index")); }
public CrudModule(IDataContext dataContext, IValidator widgetValidator, IEventHub eventHub, ICrudService crudService, ISettings settings) { Post($"/api/v1/{settings.EntityName}/", async parameters => { var rtn = await crudService.Add(dataContext, MakeModel(), widgetValidator); if (rtn.Success) { await eventHub.OnCreated(rtn.Result); } return(rtn); }); Put($"/api/v1/{settings.EntityName}/", async parameters => { var rtn = await crudService.Update(dataContext, MakeModel(), widgetValidator); if (rtn.Success) { await eventHub.OnUpdated(rtn.Result); } return(rtn); }); Delete($"/api/v1/{settings.EntityName}/", async parameters => { var rtn = await crudService.Delete(dataContext, MakeModel(), widgetValidator); if (rtn.Success) { await eventHub.OnDeleted(rtn.Result); } return(rtn); }); }
public async Task <bool> DeleteChoreType(Guid id) { return(await Task.Run(() => { return _choreTypesService.Delete(id); })); }
public ActionResult Delete(Guid id) { try { _service.Delete(id); return(Ok()); } catch (InvalidTransactionException exception) { ModelState.AddModelError("ErrorMessage", exception.Message); return(BadRequest(ModelState)); } catch (NotFoundException) { ModelState.AddModelError("ErrorMessage", Messages.DangerRecordNotFound); return(NotFound(ModelState)); } catch (Exception) { ModelState.AddModelError("ErrorMessage", Messages.DangerRecordNotFound); return(BadRequest(ModelState)); } }
public async Task <IActionResult> OnPostDeleteAsync(int id) { _seatCategoryService.Delete(id).Wait(); SeatCategorylist = await _seatCategoryService.GetAll(); return(Page()); }
public async Task <bool> DeleteCategory(Guid id) { return(await Task.Run(() => { return _categoriesService.Delete(id); })); }
public async Task <bool> DeleteBook(Guid id) { return(await Task.Run(() => { return _employeesService.Delete(id); })); }
public async Task <bool> DeleteFloor(Guid id) { return(await Task.Run(() => { return _floorsService.Delete(id); })); }
public async Task <bool> DeleteGenericElement(Guid id) { return(await Task.Run(() => { return _genericElementsService.Delete(id); })); }
public async Task <IActionResult> OnPostDeleteAsync(int id) { ThemeService.Delete(id).Wait(); Themes = await ThemeService.GetAll(); return(Page()); }
public virtual async Task <IActionResult> Delete(string key) { var model = await _service[key]; _service.Delete(model); return(Result.Factory()); }
public async Task <bool> DeleteFormat(Guid id) { return(await Task.Run(() => { return _formatValuesService.Delete(id); })); }
public async Task <bool> DeleteBuilding(Guid id) { return(await Task.Run(() => { return _buildingsService.Delete(id); })); }
public async Task <IActionResult> OnPostDeleteAsync(int id) { EnrollmentSevice.Delete(id).Wait(); Enrollments = await EnrollmentSevice.GetAll(); return(Page()); }
public async Task <IActionResult> OnPostDeleteAsync(int htnr) { SpeakerService.Delete(htnr).Wait(); Speakers = await SpeakerService.GetAll(); return(Page()); }
/// <summary> /// Supprime une permission /// </summary> /// <param name="permission"></param> public virtual void DeletePermissionRecord(PermissionRecord permission) { if (permission == null) { throw new ArgumentNullException(nameof(permission)); } _permissionRecordRepository.Delete(permission); }
public IActionResult Delete(FileEntry model) { var fileEntry = _fileEntryService.GetById(model.Id); _fileEntryService.Delete(fileEntry); _fileManager.Delete(fileEntry); return(RedirectToAction(nameof(Index))); }
public void DeleteShouldDeleteEntity() { var input = new DeleteConfirmInput { Id = 123 }; countryController.Delete(input).ShouldBeJson(); A.CallTo(() => countryCrudSrv.Delete(input.Id)).MustHaveHappened(); }
public IActionResult DeleteAssignee(long id) { if (service.IsInDataBase(id)) { service.Delete(id); return(Ok()); } return(StatusCode(404, new ErrorMessage("No such todo"))); }