public void GetTemplateById() { TemplatesOperationMockService mock = new TemplatesOperationMockService(); FileOperationMockService mockFile = new FileOperationMockService(); TemplateController controllerMock = new TemplateController(mock, mockFile); int countOld = mock.GetTemplates().Count; var result = ((OkObjectResult)controllerMock.GetTemplate(mock.GetTemplates().FirstOrDefault().TemplateID)).Value; Assert.True(result != null); }
protected void btnSave_Click(object sender, EventArgs e) { tabchanged = (bool)ViewState["tabchanged"]; if (tabchanged) { string id; if (comboboxTemplate.SelectedItem == null) { TemplateViewModel model = templatecontroller.GetTemplateByStatusIdLast(value); model.Name = txtEdit.Text; model.Title = txtSubject.Text; model.Text = HtmlEditorContent.Html; templatecontroller.UpdateTemplate(model); } else { id = comboboxTemplate.SelectedItem.Value.ToString(); var template = templatecontroller.GetTemplate(id); template.Name = txtEdit.Text; template.Title = txtSubject.Text; //HtmlEditorContent.Html += templatecontroller.GetCustomerTable(); template.Text = HtmlEditorContent.Html; templatecontroller.UpdateTemplate(template); } } if (!String.IsNullOrEmpty(txtEdit.Text) && !(tabchanged)) { TemplateViewModel model = templatecontroller.GetTemplateByStatusIdLast(value); model.Name = txtEdit.Text; model.StatusId = value; model.Title = txtSubject.Text; model.Text = HtmlEditorContent.Html; templatecontroller.UpdateTemplate(model); } BindTemplates(); }
public static void GetAll(object parameters) { IList <Model_Template> ret = TemplateController.GetTemplate(parameters); AppTools.SendResponse(HttpContext.Current.Response, ret.ObjectToJSON()); }