Ejemplo n.º 1
0
        public ActionResult RegistrationAdd(CompleteDetailsViewModel addRegistration)
        {
            int exists = userBll.checkIfExists(Convert.ToInt32(TempData["id"]));

            if (exists == 0)
            {
                int count = userBll.AddVehicle(addRegistration);
                if (count == 2)
                {
                    TempData["message"] = "Succesfully Added";
                    return(RedirectToAction("Home", "User"));
                }
                else
                {
                    TempData["message"] = "Cannot be added as the Vehicle number already exists";
                    return(RedirectToAction("Home", "User"));
                }
            }
            else
            {
                int isEdit = userBll.EditVehicleRegistration(Convert.ToInt32(TempData["VehicleId"]), addRegistration);
                if (isEdit == 2)
                {
                    TempData["message"] = "Succesfully Edited";
                    return(RedirectToAction("Home", "User"));
                }
                else
                {
                    TempData["message"] = "Cannot be Edited";
                    return(RedirectToAction("Home", "User"));
                }
            }
        }