Exemplo n.º 1
0
        public async Task <IActionResult> PutLeavingSyone(int id, LeavingSyone leavingSyone)
        {
            if (id != leavingSyone.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <LeavingSyone> > PostLeavingSyone(LeavingSyone leavingSyone)
        {
            _context.LeavingSyone.Add(leavingSyone);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (LeavingSyoneExists(leavingSyone.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetLeavingSyone", new { id = leavingSyone.Id }, leavingSyone));
        }
Exemplo n.º 3
0
        public async Task <ActionResult <IEnumerable <LeavingSyone> > > GetLeavingSyone([FromQuery] LeavingSyone leaving)
        {
            IQueryable <LeavingSyone> leavingsyone = _context.LeavingSyone;

            if (!string.IsNullOrEmpty(leaving.Designation))
            {
                leavingsyone = leavingsyone.Where(
                    s => s.Designation.ToLower().Contains(leaving.Designation.ToLower()));
            }



            return(await leavingsyone.ToListAsync());
        }