コード例 #1
0
        public int CreateCategory(JObject param)
        {
            int    status        = 0;
            string category_name = "";
            string category_type = "";

            try
            {
                category_name = (string)param.GetValue("catname");
                category_type = (string)param.GetValue("cattype");


                category cat = new category();
                cat.category_name = category_name;
                cat.category_type = category_type;
                cat.status        = 1;
                cat.created_date  = DateTime.Now;
                context.categories.Add(cat);
                context.SaveChanges();
                status = 1;
            }
            catch (Exception e)
            {
                Logdetails.LogError("Post Error", "CreateCategoryerror admincontroller (69)", e.Message);
            }

            return(status);
        }
コード例 #2
0
        public int signupsite(JObject param)
        {
            int    status = 0;
            string fname  = "";
            string lname  = "";
            string email  = "";
            string pword  = "";

            try
            {
                fname = (string)param.GetValue("firstname");
                lname = (string)param.GetValue("lastname");
                email = (string)param.GetValue("email");
                pword = (string)param.GetValue("password");

                user_details us = new user_details();
                us.fname        = fname;
                us.lname        = lname;
                us.email        = email;
                us.password     = pword;
                us.user_type    = 1;
                us.user_status  = 1;
                us.created_date = DateTime.Now;
                context.user_details.Add(us);
                context.SaveChanges();
                status = 1;
            }
            catch (Exception e)
            {
                Logdetails.LogError("Post Error", "signuperror signupcontroller (19)", e.Message);
            }

            return(status);
        }
コード例 #3
0
        public int CreateProduct(JObject param)
        {
            int    status           = 0;
            string product_name     = "";
            string product_category = "";
            int    product_unit_qty = 0;
            string product_unit     = "";

            try
            {
                product_name     = (string)param.GetValue("proname");
                product_category = (string)param.GetValue("procat");
                product_unit_qty = (int)param.GetValue("prounitqty");
                product_unit     = (string)param.GetValue("prounit");


                product pro = new product();
                pro.product_name     = product_name;
                pro.product_category = product_category;
                pro.product_unit_qty = product_unit_qty;
                pro.product_unit     = product_unit;
                pro.status           = 1;
                context.products.Add(pro);
                context.SaveChanges();
                status = 1;
            }
            catch (Exception e)
            {
                Logdetails.LogError("Post Error", "CreateProducterror admincontroller (100)", e.Message);
            }

            return(status);
        }