public async Task <IActionResult> PutCliente(int id, LaMinka.Logica.Model.Cliente cliente)
        {
            if (id != cliente.Id)
            {
                return(BadRequest());
            }

            _context.Entry(cliente).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ClienteExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> Create([Bind("Id,Nombre,Apellido,Email,Password,IdUserAlta,IdUserModif,IdUserBaja,FechaAlta,FechaModif,FechaBaja,Activo,AlertaPedidoEnCamino,AlertaHabilitaPedido,MismoUltimoPedido")] Cliente cliente)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cliente);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cliente));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("Name,LastName,DocumentNumber,PhoneNumber,UserToken,CreationDate,BirthDate,IsDeleted,Id,Password,Email,EmailConfirmed,Active")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Exemple #4
0
        public async Task <Producto> DeleteById(int?id)
        {
            var producto = await _context.Producto.FindAsync(id);

            producto.IdUserBaja = 1;

            producto.Activo    = false;
            producto.FechaBaja = DateTime.Now;
            try
            {
                _context.Producto.Update(producto);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(producto);
        }