/// <summary> /// Updates the letters. /// </summary> /// <param name="lettersModel">The letters model.</param> /// <returns>Response<LettersModel>.</returns> public Response <LettersModel> UpdateLetters(LettersModel lettersModel) { var lettersRepository = unitOfWork.GetRepository <LettersModel>(SchemaName.Registration); var procParams = BuildSpParams(lettersModel); return(unitOfWork.EnsureInTransaction(lettersRepository.ExecuteNQStoredProc, "usp_UpdateContactLetters", procParams, forceRollback: lettersModel.ForceRollback.GetValueOrDefault(false))); }
private List <SqlParameter> BuildSpParams(LettersModel lettersModel) { var spParameters = new List <SqlParameter>(); if (lettersModel.ContactLettersID > 0) // Only in case of Update { spParameters.Add(new SqlParameter("ContactLettersID", lettersModel.ContactLettersID)); } spParameters.AddRange(new List <SqlParameter> { new SqlParameter("ContactID", (object)lettersModel.ContactID), new SqlParameter("SentDate", (object)lettersModel.SentDate ?? DBNull.Value), new SqlParameter("UserID", (object)lettersModel.UserID ?? DBNull.Value), new SqlParameter("AssessmentID", (object)lettersModel.AssessmentID ?? DBNull.Value), new SqlParameter("ResponseID", (object)lettersModel.ResponseID ?? DBNull.Value), new SqlParameter("Comments", (object)lettersModel.Comments ?? DBNull.Value), new SqlParameter("LetterOutcomeID", (object)lettersModel.LetterOutcomeID ?? DBNull.Value), new SqlParameter("ModifiedOn", lettersModel.ModifiedOn ?? DateTime.Now) }); return(spParameters); }
public static LettersModel ToModel(this LettersViewModel model) { if (model == null) { return(null); } var entity = new LettersModel { ContactLettersID = model.ContactLettersID, ContactID = model.ContactID, AssessmentID = model.AssessmentID, ResponseID = model.ResponseID, SentDate = model.SentDate, UserID = model.UserID, ProviderName = model.ProviderName, LetterOutcomeID = model.LetterOutcomeID, Comments = model.Comments, ModifiedOn = model.ModifiedOn }; return(entity); }
public static LettersViewModel ToViewModel(this LettersModel entity) { if (entity == null) { return(null); } var model = new LettersViewModel { ContactLettersID = entity.ContactLettersID, ContactID = entity.ContactID, AssessmentID = entity.AssessmentID, ResponseID = entity.ResponseID, SentDate = entity.SentDate, UserID = entity.UserID, ProviderName = entity.ProviderName, LetterOutcomeID = entity.LetterOutcomeID, Comments = entity.Comments, ModifiedOn = entity.ModifiedOn }; return(model); }
/// <summary> /// Updates the letters. /// </summary> /// <param name="lettersModel">The letters model.</param> /// <returns>Response<LettersModel>.</returns> public Response <LettersModel> UpdateLetters(LettersModel lettersModel) { return(_lettersService.UpdateLetters(lettersModel)); }
/// <summary> /// Adds the letters. /// </summary> /// <param name="lettersModel">The letters model.</param> /// <returns>Response<LettersModel>.</returns> public Response <LettersModel> AddLetters(LettersModel lettersModel) { return(_lettersService.AddLetters(lettersModel)); }
/// <summary> /// Updates the letters. /// </summary> /// <param name="lettersModel">The letters model.</param> /// <returns>Response<LettersModel>.</returns> public Response <LettersModel> UpdateLetters(LettersModel lettersModel) { const string apiUrl = BaseRoute + "UpdateLetters"; return(communicationManager.Put <LettersModel, Response <LettersModel> >(lettersModel, apiUrl)); }
public IHttpActionResult UpdateLetters(LettersModel lettersModel) { return(new HttpResult <Response <LettersModel> >(_lettersDataProvider.UpdateLetters(lettersModel), Request)); }
public IHttpActionResult UpdateLetters(LettersModel lettersModel) { return(new HttpResult <Response <LettersModel> >(_lettersRuleEngine.UpdateLetters(lettersModel), Request)); }