Example #1
0
        public ActionResult EditOnlyEp(Guid epId, string epName, string totalTrack)
        {
            ViewBag.Title  = "Edit Ep";
            logics         = new GeneralLogics();
            businessLogics = new BusinessLogics();

            List <string> inputStrings = new List <string> {
                epName, totalTrack
            };

            //string userEmail = Session["LoginEmail"].ToString();
            string userEmail = "*****@*****.**";

            if (userEmail != null)
            {
                if (!logics.ContainsAnyNullorWhiteSpace(inputStrings))
                {
                    if (logics.ContainsOnlyDigits(totalTrack))
                    {
                        if (Convert.ToInt32(totalTrack) > 7)
                        {
                            TempData["ErrorMsg"] = "An Ep can be created with 7 or less amount of tracks";
                            //ViewBag.ErrorMsg = "An Ep can be created with 7 or less amount of tracks";
                        }
                        else
                        {
                            var result = businessLogics.EditEp(epId, epName, Convert.ToInt32(totalTrack));

                            if (result == 0)
                            {
                                ViewBag.ErrorMsg = "No Account is associated with the email address from which user is trying to modify the Ep.";
                            }
                            if (result == 1)
                            {
                                return(RedirectToAction("Index", "UserProfile"));
                            }
                            if (result == 2)
                            {
                                ViewBag.ErrorMsg = "No purchase left to create an music Ep";
                            }
                            if (result == 3 || result == 4)
                            {
                                ViewBag.ErrorMsg = "Internal error occured while creating the Ep";
                            }
                        }
                    }
                    else
                    {
                        TempData["ErrorMsg"] = "Track number field must contains only number. Invalid input given";
                        //ViewBag.ErrorMsg = "Track number field must contains only number. Invalid input given";
                    }
                }
                else
                {
                    TempData["ErrorMsg"] = "No fields should be left empty";
                    //ViewBag.ErrorMsg = "No fields should be left empty";
                }
            }
            else
            {
                return(RedirectToAction("Logout", "Authentication"));
            }
            return(RedirectToAction("EditOnlyEp", new { epID = epId }));
        }