Ejemplo n.º 1
0
        public IHttpActionResult PutTemplate_Position(int id, Template_Position template_Position)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != template_Position.Template_Position_ID)
            {
                return(BadRequest());
            }

            db.Entry(template_Position).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Template_PositionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public IHttpActionResult PutProduct_Type(int id, Product_Type product_Type)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != product_Type.Product_Type_ID)
            {
                return(BadRequest());
            }

            db.Entry(product_Type).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Product_TypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        public IHttpActionResult PutCustomer_Order(int id, Customer_Order customer_Order)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != customer_Order.Customer_Order_ID)
            {
                return(BadRequest());
            }

            db.Entry(customer_Order).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!Customer_OrderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 4
0
        public bool SetNewPass(dynamic pss)
        {
            try
            {
                KIMODBEntities db11 = new KIMODBEntities();
                string         usr  = pss.usrn;
                User           user = db11.Users.Where(k => k.UserName == usr).FirstOrDefault();
                if (user != null)
                {
                    var    hash = GenerateHash(pss.pssw.Value); // Do you have to use the word value
                    string newP = hash;
                    user.UserPassword = newP;
                    user.UserPasswordChangeRequest = false;
                    //user.UserPassword = pss.pssw;

                    db11.Entry(user).State = EntityState.Modified;
                    db11.SaveChanges();

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
 public IHttpActionResult RemoveItem(int id, int bId)
 {
     try
     {
         Quotation_Request_Line delLine = db.Quotation_Request_Line.Where(s => (s.Design_ID == id) && (s.Request_Line_ID == bId)).FirstOrDefault();
         db.Entry(delLine).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
         return(Ok());
     }
     catch
     {
         return(BadRequest("Operation Failed"));
     }
 }
Ejemplo n.º 6
0
 private bool setOTP(string usrn, string OTP)
 {
     try
     {
         KIMODBEntities db10 = new KIMODBEntities();
         User           usr  = db10.Users.Where(y => y.UserName == usrn).FirstOrDefault();
         usr.ResetOTP = OTP;
         usr.UserPasswordChangeRequest = true;
         db10.Entry(usr).State         = EntityState.Modified;
         db10.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        public IHttpActionResult PutQuotation_Request(Quotation_Request quotation_Request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Entry(quotation_Request).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }