public async Task <IActionResult> PutEmployeeCategoryMaster(int id, EmployeeCategoryMaster employeeCategoryMaster) { if (id != employeeCategoryMaster.Id) { return(BadRequest()); } //_context.Entry(employeeCategoryMaster).State = EntityState.Modified; employeeCategoryMaster.ModifiedIp = Request.HttpContext.Connection.RemoteIpAddress.ToString(); employeeCategoryMaster.ModifiedOn = DateTime.Now; _context.Attach(employeeCategoryMaster); _context.Entry(employeeCategoryMaster).Property("Category").IsModified = true; _context.Entry(employeeCategoryMaster).Property("Description").IsModified = true; _context.Entry(employeeCategoryMaster).Property("Status").IsModified = true; _context.Entry(employeeCategoryMaster).Property("ModifiedIp").IsModified = true; _context.Entry(employeeCategoryMaster).Property("ModifiedOn").IsModified = true; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeCategoryMasterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <EmployeeCategoryMaster> > PostEmployeeCategoryMaster(EmployeeCategoryMaster employeeCategoryMaster) { employeeCategoryMaster.CreatedIp = Request.HttpContext.Connection.RemoteIpAddress.ToString(); _context.EmployeeCategoryMaster.Add(employeeCategoryMaster); await _context.SaveChangesAsync(); return(CreatedAtAction("GetEmployeeCategoryMaster", new { id = employeeCategoryMaster.Id }, employeeCategoryMaster)); }