/// <summary> /// To the model. /// </summary> /// <param name="model">The model.</param> /// <returns></returns> public static BenefitsAssistanceModel ToModel(this BenefitsAssistanceViewModel model) { if (model == null) { return(null); } var entity = new BenefitsAssistanceModel { BenefitsAssistanceID = model.BenefitsAssistanceID, ContactID = model.ContactID, DateEntered = model.DateEntered, UserID = model.UserID, ServiceRecordingID = model.ServiceRecordingID, ProviderName = model.ProviderName, AssessmentID = model.AssessmentID, ResponseID = model.ResponseID, DocumentStatusID = model.DocumentStatusID, ServiceRecordingVoidID = model.ServiceRecordingVoidID, ModifiedOn = model.ModifiedOn, IsVoided = model.IsVoided, ServiceStartDate = model.ServiceStartDate, ServiceEndDate = model.ServiceEndDate, ServiceItemID = model.ServiceItemID, TrackingFieldID = model.TrackingFieldID }; return(entity); }
/// <summary> /// Updates the benefits assistance. /// </summary> /// <param name="benefitsAssistanceModel">The benefits assistance model.</param> /// <returns></returns> public Response <BenefitsAssistanceModel> UpdateBenefitsAssistance(BenefitsAssistanceModel benefitsAssistanceModel) { var benefitsAssistanceRepository = unitOfWork.GetRepository <BenefitsAssistanceModel>(SchemaName.Registration); var procParams = BuildSpParams(benefitsAssistanceModel); return(unitOfWork.EnsureInTransaction(benefitsAssistanceRepository.ExecuteNQStoredProc, "usp_UpdateBenefitsAssistance", procParams, forceRollback: benefitsAssistanceModel.ForceRollback.GetValueOrDefault(false))); }
private List <SqlParameter> BuildSpParams(BenefitsAssistanceModel benefitsAssistanceModel) { var spParameters = new List <SqlParameter>(); if (benefitsAssistanceModel.BenefitsAssistanceID > 0) // Only in case of Update { spParameters.Add(new SqlParameter("BenefitsAssistanceID", benefitsAssistanceModel.BenefitsAssistanceID)); } spParameters.AddRange(new List <SqlParameter> { new SqlParameter("ContactID", (object)benefitsAssistanceModel.ContactID), new SqlParameter("DateEntered", (object)benefitsAssistanceModel.DateEntered ?? DBNull.Value), new SqlParameter("UserID", (object)benefitsAssistanceModel.UserID ?? DBNull.Value), new SqlParameter("AssessmentID", (object)benefitsAssistanceModel.AssessmentID ?? DBNull.Value), new SqlParameter("ResponseID", (object)benefitsAssistanceModel.ResponseID ?? DBNull.Value), new SqlParameter("DocumentStatusID", (object)benefitsAssistanceModel.DocumentStatusID ?? DBNull.Value), new SqlParameter("ModifiedOn", benefitsAssistanceModel.ModifiedOn ?? DateTime.Now) }); return(spParameters); }
/// <summary> /// Updates the benefits assistance. /// </summary> /// <param name="benefitsAssistanceModel">The benefits assistance model.</param> /// <returns></returns> public Response <BenefitsAssistanceModel> UpdateBenefitsAssistance(BenefitsAssistanceModel benefitsAssistanceModel) { const string apiUrl = BaseRoute + "UpdateBenefitsAssistance"; return(communicationManager.Put <BenefitsAssistanceModel, Response <BenefitsAssistanceModel> >(benefitsAssistanceModel, apiUrl)); }
public IHttpActionResult UpdateBenefitsAssistance(BenefitsAssistanceModel benefitsAssistanceModel) { return(new HttpResult <Response <BenefitsAssistanceModel> >(_benefitsAssistanceDataProvider.UpdateBenefitsAssistance(benefitsAssistanceModel), Request)); }
/// <summary> /// Updates the benefits assistance. /// </summary> /// <param name="benefitsAssistanceModel">The benefits assistance model.</param> /// <returns></returns> public Response <BenefitsAssistanceModel> UpdateBenefitsAssistance(BenefitsAssistanceModel benefitsAssistanceModel) { return(benefitsAssistanceService.UpdateBenefitsAssistance(benefitsAssistanceModel)); }
/// <summary> /// Adds the benefits assistance. /// </summary> /// <param name="benefitsAssistanceModel">The benefits assistance model.</param> /// <returns></returns> public Response <BenefitsAssistanceModel> AddBenefitsAssistance(BenefitsAssistanceModel benefitsAssistanceModel) { return(benefitsAssistanceService.AddBenefitsAssistance(benefitsAssistanceModel)); }
public IHttpActionResult UpdateBenefitsAssistance(BenefitsAssistanceModel benefitsAssistanceModel) { return(new HttpResult <Response <BenefitsAssistanceModel> >(benefitsAssistanceRuleEngine.UpdateBenefitsAssistance(benefitsAssistanceModel), Request)); }