コード例 #1
0
        public async Task <IActionResult> PutEmployeeAttendance(int id, EmployeeAttendance employeeAttendance)
        {
            if (id != employeeAttendance.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutProjectCategoryMaster(int id, ProjectCategoryMaster projectCategoryMaster)
        {
            if (id != projectCategoryMaster.Id)
            {
                return(BadRequest());
            }

            //_context.Entry(projectCategoryMaster).State = EntityState.Modified;

            projectCategoryMaster.ModifiedIp = Request.HttpContext.Connection.RemoteIpAddress.ToString();
            projectCategoryMaster.ModifiedOn = DateTime.Now;
            _context.Attach(projectCategoryMaster);
            _context.Entry(projectCategoryMaster).Property("Name").IsModified        = true;
            _context.Entry(projectCategoryMaster).Property("Description").IsModified = true;
            _context.Entry(projectCategoryMaster).Property("Status").IsModified      = true;
            _context.Entry(projectCategoryMaster).Property("ModifiedIp").IsModified  = true;
            _context.Entry(projectCategoryMaster).Property("ModifiedOn").IsModified  = true;

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

            return(NoContent());
        }