public IHttpActionResult InsertUpdateDoctorResidency([FromBody] DoctorResidency doctorResidency) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var DoctorBLObj = _Kernel.Get <IDoctorBL>(); doctorResidency.Active = true; var doctorResidencyResult = DoctorBLObj.InsertUpdateDoctorResidency(doctorResidency, null); return(Ok(doctorResidencyResult.Message)); }
public DoctorResidencyResponse InsertUpdateDoctorResidency(DoctorResidency doctorResidency, string operation) { try { return(this._doctorDA.InsertUpdateDoctorResidency(doctorResidency, operation)); } catch (Exception ex) { throw; } finally { //Log } }
public DoctorResidencyResponse InsertUpdateDoctorResidency(DoctorResidency doctorResidency, string operation) { try { Log.Info("Started call to InsertUpdateDoctorResidency"); Log.Info("parameter values" + JsonConvert.SerializeObject(new { doctorResidency = doctorResidency, operation = operation })); Command.CommandText = "SP_DOCTOR_RESIDENCY_MANAGER"; Command.CommandType = CommandType.StoredProcedure; Command.Parameters.Clear(); Command.Parameters.AddWithValue("@DOCTOR_RESIDENCY_XML", GetXMLFromObject(doctorResidency)); if (doctorResidency.AddedBy.HasValue) { Command.Parameters.AddWithValue("@USER_ID", doctorResidency.AddedBy.Value); } else if (doctorResidency.ModifiedBy.HasValue) { Command.Parameters.AddWithValue("@USER_ID", doctorResidency.ModifiedBy.Value); } Connection.Open(); SqlDataReader reader = Command.ExecuteReader(); DoctorResidencyResponse result = new DoctorResidencyResponse(); if (reader.HasRows) { while (reader.Read()) { result = new DoctorResidencyResponse { Message = reader["ReturnMessage"] != DBNull.Value ? reader["ReturnMessage"].ToString() : null, IsSuccess = Convert.ToBoolean(reader["Result"].ToString()) }; } } Log.Info("End call to InsertUpdateDoctorResidency"); return(result); } catch (Exception ex) { throw; } finally { Connection.Close(); } }
public DoctorResidencyModel() { DoctorResidencyObject = new DoctorResidency(); }