public ServiceStepTests() { serviceController = new ServiceController(); variableController = new VariableController(); step = new ServiceSteps(variableController, serviceController); requestInfo = new RequestInfo() { Url = "http://test", Method = HttpMethod.Get, Headers = new Dictionary <string, string>() { { "Content-type", "application/json" } }, Content = new StringContent("test") }; }
public void InsertForm() { string new_filename = string.Empty; if (fuImage.PostedFile.ContentLength != 0) { string original_filename = Path.GetFileName(fuImage.PostedFile.FileName); new_filename = Guid.NewGuid().ToString() + Path.GetExtension(original_filename); string new_filepath = Server.MapPath("~/Uploads/Service/" + new_filename); fuImage.PostedFile.SaveAs(new_filepath); ViewState["GImage"] = new_filename; } using (VaranegarEntities db = new VaranegarEntities()) { ServiceSteps p = new ServiceSteps(); p.ServiceStepID = Guid.NewGuid(); p.ServiceStepTitle = txtTitle.Text; p.En_ServiceStepTitle = txtENTitle.Text; p.ServiceStepName = txtName.Text; p.En_ServiceStepDesc = reEN_Desc.Text; p.ServiceStepDesc = reDesc.Text; p.fk_ServiceID = new Guid(ddlServices.SelectedValue); p.LastUpdateDate = DateTime.Now; p.Priority = Convert.ToInt32(txtPrio.Text); p.IsDelete = false; p.SubmitDate = DateTime.Now; p.ServiceStepImage = new_filename; p.SmallDesc = txtHeader.Text; p.En_SmallDesc = txtHeaderEn.Text; db.ServiceSteps.Add(p); db.SaveChanges(); } }