public ActionResult resetPassword(int id, [FromBody] string password) { EmployeeInfo employeeInfo = _context.EmployeeInfo.FirstOrDefault(x => x.EmployeeId == id); employeeInfo.Password = password; _context.EmployeeInfo.Update(employeeInfo); _context.SaveChanges(); return(Ok(employeeInfo)); }
public int category([FromBody] DeviceCategory dc) { var obj = _context.DeviceCategory.FirstOrDefault(x => x.DeviceType == dc.DeviceType); if (obj == null) { _context.DeviceCategory.Add(dc); _context.SaveChanges(); } return(_context.DeviceCategory.FirstOrDefault(x => x.DeviceType == dc.DeviceType).CategoryId); }