Пример #1
0
        public async Task <IActionResult> PutOutlet([FromRoute] int id, [FromBody] Outlet outlet)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != outlet.Id)
            {
                return(BadRequest());
            }

            outlet.ModifiedDate   = DateTime.Now;
            outlet.LastModifiedBy = "leila";

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <IActionResult> PutGctype([FromRoute] int id, [FromBody] Gctype gctype)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != gctype.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #3
0
        public async Task <IActionResult> PutAspNetUsers([FromRoute] string id, [FromBody] AspNetUsers aspNetUsers)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != aspNetUsers.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }