Пример #1
0
        public async Task<IHttpActionResult> PutTenLogin(int id, TenLogin tenLogin)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != tenLogin.LoginIndex)
            {
                return BadRequest();
            }

            tldb.Entry(tenLogin).State = EntityState.Modified;

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

            return StatusCode(HttpStatusCode.NoContent);
        }
Пример #2
0
        public async Task<IHttpActionResult> PostTenLogin(TenLogin tenLogin)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            tldb.TenLogins.Add(tenLogin);
            await tldb.SaveChangesAsync();

            return CreatedAtRoute("DefaultApi", new { id = tenLogin.LoginIndex }, tenLogin);
        }