mirror of
				https://github.com/D4M13N-D3V/comissions-app-core-api.git
				synced 2025-10-31 09:35:25 +00:00 
			
		
		
		
	fix: put checks for if they are already accepted/declined/completed.
This commit is contained in:
		
							parent
							
								
									3d6b5a7781
								
							
						
					
					
						commit
						8f8b18a46c
					
				| @ -98,6 +98,16 @@ public class RequestsController : Controller | ||||
|             .Include(x=>x.Artist) | ||||
|             .Where(x=>x.Artist.UserId==userId) | ||||
|             .FirstOrDefaultAsync(x=>x.Id==requestId); | ||||
|          | ||||
|         if(request.Completed) | ||||
|             return BadRequest("Request has already been completed."); | ||||
|          | ||||
|         if(request.Accepted) | ||||
|             return BadRequest("Request has already been accepted."); | ||||
| 
 | ||||
|         if (request.Declined) | ||||
|             return BadRequest("Request has already been declined."); | ||||
|          | ||||
|         if(request==null) | ||||
|             return NotFound(); | ||||
|          | ||||
| @ -123,6 +133,15 @@ public class RequestsController : Controller | ||||
|             .FirstOrDefaultAsync(x=>x.Id==requestId); | ||||
|         if(request==null) | ||||
|             return NotFound(); | ||||
|          | ||||
|         if(request.Completed) | ||||
|             return BadRequest("Request has already been completed."); | ||||
|          | ||||
|         if(request.Accepted) | ||||
|             return BadRequest("Request has already been accepted."); | ||||
| 
 | ||||
|         if (request.Declined) | ||||
|             return BadRequest("Request has already been declined."); | ||||
|         request.Declined = true; | ||||
|         request.DeclinedDate = DateTime.UtcNow; | ||||
|         _dbContext.Entry(request).State = EntityState.Modified; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Damien Ostler
						Damien Ostler