コード例 #1
0
        public ActionResult CreateOwner(VMOwner model)
        {
            if (ModelState.IsValid)
            {
                if (model.OwnerId == 0) //create
                {
                    var owner = new Owner
                        {
                            OwnerName = model.OwnerName,
                            OwnerDirectory = model.OwnerDirectory,
                            UserId = model.UserId
                        };

                    var newOwnerId = GalleryService.InsertOwner(owner);
                    model.OwnerId = newOwnerId;
                    model.AddOKMessage("Nový vlastník galerie úspěšně přidán.");
                }
            }

            return View(model);
        }
コード例 #2
0
        public ActionResult CreateOwner(string id)
        {
            int IdUser;

            if (!int.TryParse(id, out IdUser))
            {
                return RedirectToAction("AdminList");
            }

            ViewBag.Title = "Založení nového vlastníka galerie";

            var user = UserService.GetUser(IdUser);
            var ownerName = user != null ? user.UserName : "";
            var model = new VMOwner
                {
                    UserId = IdUser,
                    OwnerName = ownerName,
                    OwnerDirectory = SEO.ConvertTextForSEOURL(ownerName)
                };

            return View(model);
        }