Example #1
0
 // POST: api/Steps
 public void Post(HttpRequestMessage request)
 {
     string body = request.Content.ReadAsStringAsync().Result;
     ptStep d = JsonConvert.DeserializeObject<ptStep>(body);
     string sql = "INSERT INTO [pubtrack].[tblSteps]([StepId],[StepName],[Active]) VALUES ('" +
     d.StepId + "','" + d.StepName + "','" + d.Active.ToString() + "');";
     ptsHelper.ExcecuteSql(sql);
 }
Example #2
0
 // PUT: api/Steps/5
 public void Put(string id, HttpRequestMessage request)
 {
     string body = request.Content.ReadAsStringAsync().Result;
     ptStep d = JsonConvert.DeserializeObject<ptStep>(body);
     string sql = "UPDATE [pubtrack].[tblSteps] SET [StepName] = '" +
     d.StepName + "',[Active] = '" + d.Active.ToString() +
     "' WHERE StepId = '" + d.StepId + "';";
     ptsHelper.ExcecuteSql(sql);
 }
Example #3
0
        // POST api/<controller>
        public void Post(HttpRequestMessage request)
        {
            string json   = File.ReadAllText(path);
            var    items  = JsonConvert.DeserializeObject <List <ptStep> >(json);
            string body   = request.Content.ReadAsStringAsync().Result;
            ptStep newPub = JsonConvert.DeserializeObject <ptStep>(body);

            items.Add(newPub);
            File.WriteAllText(path, JsonConvert.SerializeObject(items));
        }
Example #4
0
 public ActionResult Edit(string id, [Bind(Include = "StepId,StepName,Active")] ptStep Step)
 {
     if (Pubtracker2FrontEnd.ptHelper.Edit <ptStep>(id, "steps", Step))
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(Step));
     }
 }
Example #5
0
 public ActionResult Create([Bind(Include = "StepId,StepName,Active")] ptStep Step)
 {
     if (Pubtracker2FrontEnd.ptHelper.Create <ptStep>("steps", Step))
     {
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(Step));
     }
 }
Example #6
0
        // PUT api/<controller>/5
        public void Put(string id, HttpRequestMessage request)
        {
            string json       = File.ReadAllText(path);
            var    items      = JsonConvert.DeserializeObject <List <ptStep> >(json);
            string body       = request.Content.ReadAsStringAsync().Result;
            ptStep updatedPub = JsonConvert.DeserializeObject <ptStep>(body);
            int    index      = items.IndexOf(items.Find(x => x.StepId == id));

            if (index != -1)
            {
                items[index] = updatedPub;
            }
            File.WriteAllText(path, JsonConvert.SerializeObject(items));
        }
Example #7
0
        }//End GetAll Roles

        public static List<ptStep> GetAllSteps()
        {
            List<ptStep> items = new List<ptStep>();
            string sql = "Select * from pubtrack.tblSteps;";
            DataSet ds = ExecuteSPDataSetText(sql, conn);
            foreach (DataRow r in ds.Tables[0].Rows)
            {
                ptStep item = new ptStep();
                item.StepId = r["StepId"].ToString();
                item.StepName = r["StepName"].ToString();
                item.Active = Convert.ToBoolean(r["Active"].ToString());
                items.Add(item);
            }
            return items;
        }//End GetAll Steps
Example #8
0
 // GET: api/Steps/5
 public string Get(string id)
 {
     ptStep item = ptsHelper.GetAllSteps().Find(x => x.StepId == id);
     return JsonConvert.SerializeObject(item);
 }