public IHttpActionResult PutEmaployeeMaster(tblTestPatient employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { tblTestPatient objEmp = new tblTestPatient(); objEmp = objEntity.tblTestPatients.Find(employee.patPatientId); if (objEmp != null) { objEmp.patPatientName = employee.patPatientName; objEmp.patAddress = employee.patAddress; objEmp.patEmailId = employee.patEmailId; objEmp.patDateOfBirth = employee.patDateOfBirth; objEmp.patGender = employee.patGender; objEmp.patPinCode = employee.patPinCode; } int i = this.objEntity.SaveChanges(); } catch (Exception) { throw; } return(Ok(employee)); }
public IHttpActionResult DeleteEmaployeeDelete(int id) { //int empId = Convert.ToInt32(id); tblTestPatient emaployee = objEntity.tblTestPatients.Find(id); if (emaployee == null) { return(NotFound()); } objEntity.tblTestPatients.Remove(emaployee); objEntity.SaveChanges(); return(Ok(emaployee)); }
public IHttpActionResult PostEmaployee(tblTestPatient data) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { objEntity.tblTestPatients.Add(data); objEntity.SaveChanges(); } catch (Exception ex) { throw; } return(Ok(data)); }
public IHttpActionResult GetEmaployeeById(string patPatientId) { tblTestPatient objEmp = new tblTestPatient(); int ID = Convert.ToInt32(patPatientId); try { objEmp = objEntity.tblTestPatients.Find(ID); if (objEmp == null) { return(NotFound()); } } catch (Exception) { throw; } return(Ok(objEmp)); }