private void AddCase() { try { var NewCase = new CaseVM { CaseDescription = txtCaseDesc.Text, CaseName = txtCaseName.Text, CaseNumber = txtCaseNumer.Text, CaseTypeId = int.Parse(ddlCaseType.SelectedValue), CaseTypeName = ddlCaseType.SelectedItem.Text, CreatedBy = "logged On User", CaseStatusId = (int)Enums.CaseStatus.Open, CaseStatusName = Enums.CaseStatus.Open.ToString(), ClientId = int.Parse(ddlClients.SelectedValue), DateOpened = DateTime.Parse(txtDate.Text), CompanyId = CurrentUser.CompanyId }; var response = _httpHelper.Post(NewCase, appConfig.apiBaseUrl + "/api/Case"); if (response.IsSuccessStatusCode) { // var strresponse = _httpHelper.ReadString(response); Server.Transfer("/Pages/Cases/View.aspx"); } } catch (Exception ex) { LogHelper.Log(ex); } }
public int Add(CaseVM oCaseVM) { var oClientProfile = _mappingHelper.Map <Case>(oCaseVM); _caseRepo.Add(oClientProfile, GetType().Name); return(this.unitOfWork.SaveChanges()); }
public int Add(CaseVM oCaseVM) { var oClientProfile = _mappingHelper.Map <Case>(oCaseVM); _caseRepo.Add(oClientProfile, GetType().Name); return(1); }
public static List <CaseVM> GetCaseVMsByUserID(int userID) { List <CaseVM> cases = new List <CaseVM>(); foreach (Case item in context.CaseFactory.GetAllBy("UserID", userID)) { CaseVM vm = CreateCaseVM(item.ID); cases.Add(vm); } return(cases); }
public static CaseVM CreateCaseVM(int caseID) { CaseVM vm = new CaseVM() { Case = context.CaseFactory.Get(caseID), Tasks = CreateTaskVMs(caseID), }; vm.User = context.UserFactory.Get(vm.Case.UserID); return(vm); }
public CaseVM Get(string caseNumber, int companyId) { CaseVM oClientProfileModel = null; try { var oClientProfile = _caseRepo.All(GetType().Name).Where(x => x.CaseNumber == caseNumber && x.CompanyId == companyId).FirstOrDefault(); oClientProfileModel = _mappingHelper.Map <CaseVM>(oClientProfile); } catch (Exception) { } return(oClientProfileModel); }
public IHttpActionResult Add([FromBody] CaseVM oCaseVM) { try { if (!ModelState.IsValid) { return(BadRequest()); } var result = _caseService.Add(oCaseVM); if (result >= 1) { return(Ok(oCaseVM)); } return(BadRequest("Server could not fulfil request")); } catch (Exception ex) { LogHelper.Log(ex); return(InternalServerError(ex)); } }