Example #1
0
        public void InsertQuickURL(QuickURLSubmitModel MyQuickURL)
        {
            using (TransactionScope Trans = new TransactionScope())
            {
                try
                {
                    tbl_User u = MyQuickURL.MyUser;
                    u.Password = u.ConfirmPassword = "******";
                    u.Role     = "U";
                    userBs.Insert(u);

                    tbl_Url myUrl = MyQuickURL.MyUrl;
                    myUrl.UserId     = u.UserId;
                    myUrl.UrlDesc    = myUrl.UrlTitle;
                    myUrl.IsApproved = "P";
                    urlbs.Insert(myUrl);

                    Trans.Complete();
                }
                catch (Exception E1)
                {
                    throw new Exception(E1.Message);
                }
            }
        }
Example #2
0
 public ActionResult Create(QuickURLSubmitModel myQuickURL)
 {
     try
     {
         ModelState.Remove("MyUser.Password");
         ModelState.Remove("MyUser.ConfirmPassword");
         ModelState.Remove("MyUrl.UrlDesc");
         if (ModelState.IsValid)
         {
             objbs.InsertQuickURL(myQuickURL);
             TempData["Msg"] = "Created Successfully";
             return(RedirectToAction("Index"));
         }
         else
         {
             ViewBag.CategoryId = new SelectList(objbs.categoryBs.Getall().ToList(), "CategoryId", "CategoryName");
             return(View("Index"));
         }
     }
     catch (Exception ex)
     {
         TempData["Msg"] = "Created Failed : " + ex.Message;
         return(RedirectToAction("Index"));
     }
 }
Example #3
0
        public void InsertQuickUrl(QuickURLSubmitModel myQuickUrl)
        {
            using (TransactionScope Trans = new TransactionScope())
            {
                try
                {
                    tbl_User user = myQuickUrl.MyUser;
                    user.Password = user.ConfirmPassword = "******";
                    user.Role     = "U";
                    userBs.Insert(user);

                    tbl_Url myUrl = myQuickUrl.MyUrl;
                    myUrl.UserId     = user.UserId;
                    myUrl.UrlDesc    = myUrl.UrlTitle;
                    myUrl.IsApproved = "P";
                    urlBs.Insert(myUrl);

                    Trans.Complete();
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
        }
Example #4
0
        public IResponse InsertQuickURL(QuickURLSubmitModel quickUrl)
        {
            IResponse Resp;

            using (TransactionScope transaction = new TransactionScope())
            {
                T_User myUser = quickUrl.MyUser;
                myUser.Password = myUser.ConfirmPassword = "******";

                Resp = UserBs.GetInstance().Insert(myUser);

                if (Resp.IsError)
                {
                    return(Resp);
                }

                T_Url myUrl = quickUrl.MyUrl;
                myUrl.UserId     = myUser.UserId;
                myUrl.UrlDesc    = myUrl.UrlTitle;
                myUrl.IsApproved = "P";

                Resp = base.Insert(myUrl);
                if (Resp.IsError)
                {
                    return(Resp);
                }

                transaction.Complete();
            }

            return(Resp);
        }
Example #5
0
        public ActionResult Create(QuickURLSubmitModel quickUrl)
        {
            ModelState.Remove("MyUser.Password");
            ModelState.Remove("MyUser.ConfirmPassword");
            ModelState.Remove("MyUrl.UrlDesc");

            if (!ModelState.IsValid)
            {
                ViewBag.CategoryId = CategoryList;
                return(View("Index"));
            }


            TempData["Resp"] = AreaBs.UrlBs.InsertQuickURL(quickUrl);
            return(RedirectToAction("Index"));
        }
Example #6
0
        public ActionResult Create(QuickURLSubmitModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.CategoryId = new SelectList(db.CategoryBs.GetAll(), "CategoryId", "CategoryName");

                    return(View());
                }
            }
            catch (Exception e)
            {
                return(RedirectToAction("Index"));
            }
        }// end create
        public ActionResult Create(QuickURLSubmitModel myQuickUrl)
        {
            try
            {
                ModelState.Remove("MyUser.Password");
                ModelState.Remove("MyUser.ConfirmPassword");
                ModelState.Remove("MyUser.UrlDesc");

                if (ModelState.IsValid)
                {
                    objBs.InsertQuickUrl(myQuickUrl);
                    TempData["Msg"] = "Created successfully.";
                }
                InitializeSelects();
                return(View("Index"));
            }
            catch (Exception e)
            {
                TempData["Msg"] = "Create failed. " + e.Message;
                return(View("Index"));
            }
        }