public JsonResult Create(string selectedNodeId, string title) { var insertedCompany = _CompanyChartService.Create(new CompanyChart() { Title = title, ParentId = string.IsNullOrEmpty(selectedNodeId) ? (int?)null : int.Parse(selectedNodeId) }); return(Json(new { Title = title, SelectedNodeId = selectedNodeId, id = insertedCompany.Id })); }
public HttpResponseMessage PostEntitiy(CompanyChartViewModel CompanyChart) { if (ModelState.IsValid) { var account = _companyChartService.Create(CompanyChart.Model); CompanyChart.SetModel(account); return(Request.CreateResponse(HttpStatusCode.OK, CompanyChart)); } return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, this.ModelState)); }