コード例 #1
0
        public async Task <IHttpActionResult> PutEmpPayroll(Guid id, EmpPayroll empPayroll)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != empPayroll.EmpPRID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public async Task <IHttpActionResult> PutEmployeeDetail(Guid id, EmployeeDetail employeeDetail)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != employeeDetail.EmpID)
            {
                return(BadRequest());
            }
            employeeDetail.DateCreated = DateTime.Now;
            employeeDetail.Createdby   = createdBy;

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }