示例#1
0
        public async Task <IActionResult> PutDcandidate(int id, Dcandidate dcandidate)
        {
            //if (id != dcandidate.Id)
            //{
            //    return BadRequest();
            //}
            dcandidate.Id = id;
            _context.Entry(dcandidate).State = EntityState.Modified;

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

            return(NoContent());
        }
示例#2
0
        public IHttpActionResult PutEmployee(int id, Employee employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employee.EmployeeID)
            {
                return(BadRequest());
            }

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
 public void Create(T Entity)
 {
     _employeeDB.Entry(Entity).State = EntityState.Added;
 }
 public HttpResponseMessage Put(int id, [FromBody] TblEmployee value)
 {
     EmployeeDB.Entry(value).State = EntityState.Modified;
     return(ToJson(EmployeeDB.SaveChanges()));
 }