public IHttpActionResult CreatePlanAdd(PlanAddDto planAdd) { JsonObject json = new JsonObject(); GradeVersionDAL gradeVersion = new GradeVersionDAL(); string version = gradeVersion.CheckGradeVersion(planAdd.SampleName, planAdd.LOT_NO); if (string.IsNullOrEmpty(version)) { json["Error"] = "Grade Version is NULL"; return(Ok(json)); } planAdd.GradeVersion = new Guid(version); try { DOCPlanAdd sd = JsonConvert.DeserializeObject <DOCPlanAdd>(JsonConvert.SerializeObject(planAdd));; if (!draftDAL.CreatePlanAdd(sd)) { json["Error"] = "Can not Save Plan Add"; return(Ok(json)); } else { json["Success"] = "Success"; return(Ok(json)); } } catch (Exception ex) { Console.WriteLine(ex); Loger.Error(ex); return(BadRequest(ex.Message + "-" + ex.StackTrace)); } }