public async Task <ActionResult <autopayment> > Frozen([FromBody] int id, [FromHeader] string apiToken) { AuthController newAuth = new AuthController(_context); var ActionResult = await newAuth.getId(apiToken); var client = ActionResult as OkObjectResult; if (client != null) { int userId = (int)client.Value; var autopayment = await _context.autopayment.Where(x => x.sender_id == userId && x.id_autopayment == id).FirstOrDefaultAsync(); if (autopayment == null) { return(null); } autopayment.freezing = true; autopayment.comm = "Автоплатеж заморожен по желанию пользователя. Дата - " + DateTime.Today.ToString("g"); //нужно, чтобы было состояние "редактируется" _context.Entry(autopayment).State = EntityState.Modified; await _context.SaveChangesAsync(); return(Ok("Операция заморозки карты ")); } else { return(NotFound("Данный пользователь недоступен")); } }
public async Task <IActionResult> Putautopayment_range(int id, autopayment_range autopayment_range) { if (id != autopayment_range.id_autopayment_range) { return(BadRequest()); } _context.Entry(autopayment_range).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!autopayment_rangeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Putrequest(int id, request request) { if (id != request.id_request) { return(BadRequest()); } _context.Entry(request).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!requestExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Putstatus_acc(int id, status_acc status_acc) { if (id != status_acc.id_status_acc) { return(BadRequest()); } _context.Entry(status_acc).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!status_accExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Putpayment_history(int id, payment_history payment_history) { if (id != payment_history.id_payment_history) { return(BadRequest()); } _context.Entry(payment_history).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!payment_historyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }