public IHttpActionResult SaveNewTolerance(TolerancesTolerancesModel tolerance)
 {
     IHttpActionResult ret = null;
     if (tolerance != null && tolerance.SaveNewTolerance(tolerance))
     {
         ret = Ok("Pavyko");
     }
     else
     {
         ret = Ok("Nepavyko!");
     }
     return ret;
 }
        public IHttpActionResult DeleteTolerance(int id)
        {
            IHttpActionResult ret = null;
            TolerancesTolerancesModel tol = new TolerancesTolerancesModel();
            bool del = tol.DeleteTolerance(id);
            if (del == true)
            {
                ret = Ok("Pavyko");
            }
            else
            {
                ret = Ok("failed");
            }

            return ret;
        }
        public IHttpActionResult GetTolerances(int id)
        {
            IHttpActionResult ret = null;
            List<TolerancesTolerancesModel> list = new List<TolerancesTolerancesModel>();
            TolerancesTolerancesModel table = new TolerancesTolerancesModel();
            list = table.GetTolerances(id);

            if(list.Count > 0)
            {
                ret = Ok(list);
            }
            else
            {
                ret = Ok(list);
            }
            return ret;
        }
Exemplo n.º 4
0
        public bool SaveNewTolerance(TolerancesTolerancesModel tol)
        {
            string sql = "INSERT INTO [TOLERANCE] (MEASUREMENT_Id, PROJECT_RISK_Id, Name, Value) VALUES (@MEASUREMENT_Id, @PROJECT_RISK_Id, @Name, @Value)";
            var param = new Dictionary<string, object>();
            param.Clear();
            param.Add("@MEASUREMENT_Id", 1);
            param.Add("@PROJECT_RISK_Id", tol.RiskID);
            param.Add("@Name", tol.ToleranceName);
            param.Add("@Value", tol.ToleranceValue);

            var result = DBContext.ExecuteQueryTable(sql, param);

            if (result != null)
                return true;

            return false;
        }