public static async Task <DataResponse <Guid> > Delete(Guid resourceId) { using (var db = BaseService.CreateSampleContext()) { var response = new DataResponse <Guid>(); var resource = db.Resources.Find(resourceId); if (resource == null) { response.AddError("ResourceID", "Resource not found"); } var erros = response.GetMessageFromErrors(); if (erros != string.Empty) { response.Message = erros; response.ResponseCode = 400; return(response); } db.Resources.Remove(resource); await db.SaveChangesAsync(); response.Data = resource.ResourceID; response.ResponseCode = 200; return(response); } }