public async Task <IActionResult> Create([Bind("Title,Quantity,Price,OrderID,AttachmentPath,Description,ID,NrIntern,UserID,CreateBy,UpdateBy,CreateDate,UpdateDate,OrganizationID,Remark,Deleted")] OrderPosition orderPosition) { if (ModelState.IsValid) { orderPosition.ID = Guid.NewGuid(); _context.Add(orderPosition); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrderID"] = new SelectList(_context.Orders, "ID", "NrIntern", orderPosition.OrderID); return(View(orderPosition)); }
public async Task <IActionResult> Create([Bind("Title,Description,SendDate,Status,AmountNet,SupplierOrganizationID,OrderID,ID,NrIntern,UserID,CreateBy,UpdateBy,CreateDate,UpdateDate,OrganizationID,Remark,Deleted")] Invoice invoice) { if (ModelState.IsValid) { invoice.ID = Guid.NewGuid(); _context.Add(invoice); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["OrderID"] = new SelectList(_context.Orders, "ID", "NrIntern", invoice.OrderID); ViewData["SupplierOrganizationID"] = new SelectList(_context.Organizations, "ID", "ID", invoice.SupplierOrganizationID); return(View(invoice)); }
private async Task SetUpData(UserSession userSession, ERPContext dbContext) { dbContext.Orders.Add(new Models.Order() { ID = Guid.NewGuid(), OrganizationID = userSession.OrganizationID, Title = "Unit Test", NrIntern = "Unit Test", DeliveryDate = DateTime.Now, SupplierID = Guid.NewGuid() }); dbContext.Orders.Add(new Models.Order() { ID = Guid.NewGuid(), OrganizationID = userSession.OrganizationID, Title = "Unit Test", NrIntern = "Unit Test", DeliveryDate = DateTime.Now, SupplierID = Guid.NewGuid() }); dbContext.Orders.Add(new Models.Order() { ID = Guid.NewGuid(), OrganizationID = userSession.OrganizationID, Title = "Unit Test", NrIntern = "Unit Test", DeliveryDate = DateTime.Now, SupplierID = Guid.NewGuid() }); dbContext.Orders.Add(new Models.Order() { ID = Guid.NewGuid(), OrganizationID = userSession.OrganizationID, Title = "Unit Test", NrIntern = "Unit Test", DeliveryDate = DateTime.Now, SupplierID = Guid.NewGuid() }); dbContext.Orders.Add(new Models.Order() { ID = Guid.NewGuid(), OrganizationID = Guid.NewGuid(), Title = "Unit Test", NrIntern = "Unit Test", DeliveryDate = DateTime.Now, SupplierID = Guid.NewGuid() }); await dbContext.SaveChangesAsync(); }
private async Task SetUpData(UserSession userSession, ERPContext dbContext) { dbContext.News.Add(new Models.News() { ID = Guid.NewGuid(), OrganizationID = userSession.OrganizationID, Title = "Unit Test", NrIntern = "Unit Test" }); dbContext.News.Add(new Models.News() { ID = Guid.NewGuid(), OrganizationID = userSession.OrganizationID, Title = "Unit Test", NrIntern = "Unit Test" }); dbContext.News.Add(new Models.News() { ID = Guid.NewGuid(), OrganizationID = userSession.OrganizationID, Title = "Unit Test", NrIntern = "Unit Test" }); dbContext.News.Add(new Models.News() { ID = Guid.NewGuid(), OrganizationID = Guid.NewGuid(), Title = "Unit Test", NrIntern = "Unit Test" }); dbContext.News.Add(new Models.News() { ID = Guid.NewGuid(), OrganizationID = Guid.NewGuid(), Title = "Unit Test", NrIntern = "Unit Test" }); await dbContext.SaveChangesAsync(); }
public async Task <IActionResult> Putproducto(int id, ProductoDto productoDto) { var producto = new Producto { Id = productoDto.Id, Descripcion = productoDto.Descripcion, Saldoinicial = productoDto.Saldoinicial, SaldoActual = productoDto.SaldoActual, UnidadMedidaId = productoDto.UnidadMedidaId, CostoPromedio = productoDto.CostoPromedio, PrecioVenta = productoDto.PrecioVenta, StockMinimo = productoDto.StockMinimo, StockMaximo = productoDto.StockMaximo, FechaCreacion = productoDto.FechaCreacion, FechaModificacion = productoDto.FechaModificacion, UsuarioCreacionId = productoDto.UsuarioCreacionId, UsuarioModificacionId = productoDto.UsuarioModificacionId }; if (id != producto.Id) { return(BadRequest()); } context.Entry(producto).State = EntityState.Modified; try { await context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductoExists(producto.Descripcion.Trim())) { return(NotFound()); } else { //throw; return(BadRequest()); } } return(NoContent()); }
private async Task SetUpData(ERPContext dbContext, UserSession userSession) { dbContext.Organizations.Add(new Models.Organization() { ID = userSession.OrganizationID, Title = "Unit Test", City = "Sofia", Email = "*****@*****.**" }); dbContext.Customers.Add(new Models.Customer() { ID = Guid.NewGuid(), OrganizationID = Guid.NewGuid(), CustomerOrganizationID = userSession.OrganizationID, Title = "Test Supplier", UserID = Guid.NewGuid().ToString() }); await dbContext.SaveChangesAsync(); }
private async Task SetUpData(UserSession userSession, ERPContext dbContext) { dbContext.Organizations.Add(new Models.Organization() { ID = Guid.NewGuid(), Title = "Unit Test", City = "Sofia", Email = "*****@*****.**" }); dbContext.Organizations.Add(new Models.Organization() { ID = Guid.NewGuid(), Title = "Unit Test", City = "Sofia", Email = "*****@*****.**" }); dbContext.Organizations.Add(new Models.Organization() { ID = Guid.NewGuid(), Title = "Unit Test", City = "Sofia", Email = "*****@*****.**" }); dbContext.Organizations.Add(new Models.Organization() { ID = Guid.NewGuid(), Title = "Unit Test", City = "Sofia", Email = "*****@*****.**" }); await dbContext.SaveChangesAsync(); }
public async Task SaveAsync() { await _erpContext.SaveChangesAsync(); }