public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Product).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(Product.ProductId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task<IActionResult> OnPostAsync(Guid? id) { if (id == null) { return NotFound(); } Order = await _context.Order.FindAsync(id); if (Order != null) { foreach (var package in _context.Package.Where(x => x.PackageNavigation.OrderId == Order.OrderId)) { foreach (var item in _context.PackageItem.Where(x => x.PackageId == package.PackageId)) { _context.PackageItem.Remove(item); } _context.Package.Remove(package); } foreach (var va in _context.ValorAduanalItem.Where(x => x.OrderId == Order.OrderId)) { _context.ValorAduanalItem.Remove(va); } _context.Order.Remove(Order); await _context.SaveChangesAsync(); } return RedirectToPage("././Index"); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.TipoPago.Add(TipoPago); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Contact.ContactId = Guid.NewGuid(); Contact.CreatedAt = DateTime.Now; _context.Contact.Add(Contact); Phone phone = new Phone(); phone.PhoneId = Guid.NewGuid(); phone.ReferenceId = Contact.ContactId; phone.Number = Phone; phone.Current = true; phone.Type = "Fijo"; _context.Add(phone); Phone movil = new Phone(); movil.PhoneId = Guid.NewGuid(); movil.ReferenceId = Contact.ContactId; movil.Number = Phone; movil.Current = true; movil.Type = "Movil"; _context.Add(movil); Address address = new Address(); address.AddressId = Guid.NewGuid(); address.ReferenceId = Contact.ContactId; address.AddressLine1 = Address; address.City = City; address.State = State; address.Zip = Zip; address.Country = "Estados Unidos"; address.Type = "Oficina"; address.CreatedAt = DateTime.Now; address.CreatedBy = _context.User.FirstOrDefault().UserId; //Ver Aqui va el usuario registrado address.UpdatedAt = DateTime.Now; address.UpdatedBy = _context.User.FirstOrDefault().UserId; //Ver Aqui va el usuario registrado _context.Add(address); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } ValorAduanal = await _context.ValorAduanal.FindAsync(id); if (ValorAduanal != null) { _context.ValorAduanal.Remove(ValorAduanal); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } User = await _context.User.FindAsync(id); if (User != null) { _context.User.Remove(User); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } Client = await _context.Client.FindAsync(id); if (Client != null) { foreach (var contact in _context.Contact.Where(x => x.ClientId == Client.ClientId)) { _context.Contact.Remove(contact); } _context.Client.Remove(Client); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public void EditarOrden() { order.Date = DateTime.Now.Date; order.TipoPago = _context.TipoPago.First(); order.TipoPagoId = order.TipoPago.TipoPagoId; if (type == "Mixto") { order.Number = "MX"; } else if (type == "Paquete") { order.Number = "PA"; } else if (type == "Alimentos") { order.Number = "AL"; } else if (type == "Medicina") { order.Number = "ME"; } else { order.Number = "RE"; } order.Number += DateTime.Now.ToString("MMddyyyyHHmm"); if (listVA.Count() > 0) { for (int i = 0; i < listVA.Count(); i++) { ValorAduanalItem value = new ValorAduanalItem(); value.ValorAduanalItemId = Guid.NewGuid(); value.OrderId = order.OrderId; value.Order = order; value.ValorAduanal = _context.ValorAduanal.Where(x => x.ValorAduanalId == Guid.Parse(listVA[i])).First(); value.ValorAduanalId = Guid.Parse(listVA[i]); order.ValorAduanal += value.ValorAduanal.Value; order.ValorAduanalItem.Add(value); _context.Add(value); } } order.CantLb = cantlb; order.PriceLb = preciolb; order.OtrosCostos = otrosgastos; order.ValorAduanal = valor; order.Amount = order.ValorAduanal + (order.CantLb * order.PriceLb) + order.OtrosCostos; order.Balance = order.Amount - order.ValorPagado; if (order.Balance != 0)//si el balance no es 0 el status es pendiente si el valanece es 0 iniciado, { order.Status = "Pendiente"; } else { order.Status = "Iniciada"; } _context.SaveChangesAsync(); }