Ejemplo n.º 1
0
        public async Task <IActionResult> PutLogin(decimal id, Login login)
        {
            if (id != login.LId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutEmployee(decimal id, Employee employee)
        {
            if (id != employee.EmpId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> PutVisitTable(decimal id, ViewVisitTable visitTable)
        {
            if (id != visitTable.VisitId)
            {
                return(BadRequest());
            }

            var visitFromDb = await _context.VisitTable.FirstOrDefaultAsync(r => r.VisitId == visitTable.VisitId);

            if (visitFromDb == null)
            {
                return(NotFound("No data Found"));
            }

            visitFromDb.CustName        = visitTable.CustName;
            visitFromDb.Description     = visitTable.Description;
            visitFromDb.InterestProduct = visitTable.InterestProduct;
            visitFromDb.IsDisabled      = visitTable.IsDisabled;

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

            return(NoContent());
        }