public async Task <ActionResult <InstanceDTO> > DeleteInstance(int id) { var instance = await instanceRepository.DeleteInstance(id); if (instance == null) { return(NotFound()); } return(instance); }
public async Task <ActionResult> Delete(Guid instanceId, int instanceOwnerId, bool?hard) { Instance instance = await _instanceRepository.GetOneAsync(instanceId, instanceOwnerId); if (instance == null) { return(NotFound("Didn't find the object that should be deleted with instanceId=" + instanceId)); } else { if (hard.HasValue && hard == true) { bool deletedOK = await _instanceRepository.DeleteInstance(instance); if (deletedOK) { return(Ok(true)); } } else { instance.IsDeleted = true; instance.LastChangedBy = instanceOwnerId; instance.LastChangedDateTime = DateTime.UtcNow; var result = await _instanceRepository.UpdateInstanceInCollectionAsync(instanceId, instance); if (result == null) { return(Ok(result)); } } return(BadRequest()); } }
public bool DeleteInstance(Guid instanceGuid) { return(_instanceRepository.DeleteInstance(instanceGuid)); }