コード例 #1
0
        // Create Batch in the database
        protected void CreateBtn_Click(object sender, EventArgs e)
        {
            BatchDto batch = null;

            try
            {
                // Create Batch Object
                batch = new BatchDto
                {
                    Batch_Ref = BatchReferenceTb.Text,
                    DecisionForestRegressionJobId = null,
                    LinearRegressionJobId         = null,
                    UserId = Int32.Parse(Security.GetQueryString())
                };
            }
            catch
            {
                Response.Redirect("CreateBatch?message=Error");
            }

            // Add to database
            if (BatchService.CreateBatch(batch))
            {
                Response.Redirect("Default?message=BatchCreateSuccess");
            }
            else
            {
                Response.Redirect("CreateBatch?message=Error");
            }
        }
コード例 #2
0
        public ActionResult Create(Batchs bt)
        {
            string error = string.Empty;

            if (ModelState.IsValid)
            {
                bool isSuccess = _serv.CreateBatch(bt);
                TempData["AlertCSS"] = isSuccess ? "alert success" : "alert error";

                if (!isSuccess)
                {
                    ModelState.AddModelError("", error);
                }
                else
                {
                    TempData["OutputMessage"] = "Record Successfully Created";
                }

                if (ModelState.IsValid)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View());
        }