//[AllowAnonymous] public async Task <IActionResult> Putinva_real([FromRoute] Guid id, [FromBody] inva_real varinva_real) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != varinva_real.inva_realId) { return(BadRequest()); } _context.Entry(varinva_real).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!inva_realExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
//[AllowAnonymous] public async Task <IActionResult> Postinva_real([FromBody] inva_real varinva_real) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.inva_real.Add(varinva_real); await _context.SaveChangesAsync(); return(CreatedAtAction("Getinva_real", new { id = varinva_real.inva_realId }, varinva_real)); }
public async Task <string> Operation_inventory(Guid uid, invops_inventory varinvops_in) { string result = ""; invp_data m = null; invp_tag t; t = _context.invp_tag.FirstOrDefault(t => t.RFID == varinvops_in.rfid); if (t == null) { result = "Метка не зарегистрирована. "; } if (t != null) { m = _context.invp_data.FirstOrDefault(z => z.invp_dataId == t.invp_dataId); if (m == null) { result += "Запчасть не обнаружена. "; } } invwh_cell c = null; c = _context.invwh_cell.FirstOrDefault(cc => cc.SHCODE == varinvops_in.shCode); if (c == null) { result += "Ячейка не найдена. "; } if (varinvops_in.quantity <= 0) { result += "Количество должно быть положительным числом. "; } if (t != null && m != null && c != null && varinvops_in.quantity > 0) { invwh_loc loc = null; loc = _context.invwh_loc.FirstOrDefault(l => l.invwh_locId == c.invwh_locId); inva_real e = null; { e = new inva_real(); e.inva_realId = Guid.NewGuid(); e.inva_infoId = varinvops_in.InventoryID; e.Qty = varinvops_in.quantity; e.storepartid = m.invp_dataId; e.locationid = c.invwh_locId; e.cellid = c.invwh_cellId; e.RFID = varinvops_in.rfid; if (loc != null) { e.theStore = loc.theStore; } _context.inva_real.Add(e); } await _context.SaveChangesAsync(); return("OK"); } else { await _context.SaveChangesAsync(); return(result); } }