mirror of
				https://github.com/D4M13N-D3V/comissions-app-core-api.git
				synced 2025-10-31 17:45:26 +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) |             .Include(x=>x.Artist) | ||||||
|             .Where(x=>x.Artist.UserId==userId) |             .Where(x=>x.Artist.UserId==userId) | ||||||
|             .FirstOrDefaultAsync(x=>x.Id==requestId); |             .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) |         if(request==null) | ||||||
|             return NotFound(); |             return NotFound(); | ||||||
|          |          | ||||||
| @ -123,6 +133,15 @@ public class RequestsController : Controller | |||||||
|             .FirstOrDefaultAsync(x=>x.Id==requestId); |             .FirstOrDefaultAsync(x=>x.Id==requestId); | ||||||
|         if(request==null) |         if(request==null) | ||||||
|             return NotFound(); |             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.Declined = true; | ||||||
|         request.DeclinedDate = DateTime.UtcNow; |         request.DeclinedDate = DateTime.UtcNow; | ||||||
|         _dbContext.Entry(request).State = EntityState.Modified; |         _dbContext.Entry(request).State = EntityState.Modified; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Damien Ostler
						Damien Ostler