public ActionResult Create(PermissionArea Area, ApType ApType, PostEdit PostEdit)
        {
            if (!ModelState.IsValid)
            {
                ViewData["Post"] = PostEdit;
                ViewData["Salt"] = "PostCreate";

                return View("Form" + ApType.ToProper(), Area);
            }

            //////////////////////////
            // Everything passed. Create new post
            //////////////////////////
            var post = Mapper.Map<PostEdit, Post>(PostEdit);
            middleManagement.Post.Add(post);

            //////////////////////////
            // Send user to new post
            //////////////////////////
            return RedirectToAction("View", "Blog",
                                    new
                                    {
                                        postid = post.ID,
                                        title = post.Title.ToUrlFriendly()
                                    });
        }
Exemplo n.º 2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            ApType apType = await db.ApTypes.FindAsync(id);

            db.ApTypes.Remove(apType);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public ActionResult Create(PermissionArea Area, ApType ApType)
        {
            var postEdit = GetType(ApType);

            ViewData["Post"] = postEdit;
            ViewData["Salt"] = "PostCreate";

            return View("Form" + ApType.ToProper(), Area);
        }
Exemplo n.º 4
0
        public async Task <ActionResult> Edit(ApType apType)
        {
            if (ModelState.IsValid)
            {
                db.Entry(apType).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(apType));
        }
Exemplo n.º 5
0
        public async Task <ActionResult> Create([Bind(Include = "TypeId,Name,Price,Description,NumOfPerson")] ApType apType)
        {
            if (ModelState.IsValid)
            {
                db.ApTypes.Add(apType);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(apType));
        }
Exemplo n.º 6
0
        // GET: Types/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ApType apType = await db.ApTypes.FindAsync(id);

            if (apType == null)
            {
                return(HttpNotFound());
            }
            return(View(apType));
        }
Exemplo n.º 7
0
        public override int GetHashCode()
        {
            int hash = Level.GetHashCode();

            if (Description != null)
            {
                hash ^= Description.GetHashCode();
            }
            if (Name != null)
            {
                hash ^= Name.GetHashCode();
            }
            if (Icon != null)
            {
                hash ^= Icon.GetHashCode();
            }
            hash ^= IsHidden.GetHashCode();
            hash ^= IsPassive.GetHashCode();
            hash ^= Cooldown.GetHashCode();
            hash ^= CastingTime.GetHashCode();
            hash ^= ChannelingTime.GetHashCode();
            hash ^= ForceCost.GetHashCode();
            hash ^= EnergyCost.GetHashCode();
            hash ^= ApCost.GetHashCode();
            hash ^= ApType.GetHashCode();
            hash ^= MinRange.GetHashCode();
            hash ^= MaxRange.GetHashCode();
            hash ^= GCD.GetHashCode();
            hash ^= GcdOverride.GetHashCode();
            if (AbilityTokens != null)
            {
                hash ^= AbilityTokens.GetHashCode();
            }
            hash ^= TargetArc.GetHashCode();
            hash ^= TargetArcOffset.GetHashCode();
            hash ^= TargetRule.GetHashCode();
            hash ^= LineOfSightCheck.GetHashCode();
            hash ^= Pushback.GetHashCode();
            hash ^= IgnoreAlacrity.GetHashCode();
            return(hash);
        }
Exemplo n.º 8
0
        public static decimal GetPrice(ApType type, int guestCount)
        {
            decimal price = 0M;

            if (guestCount >= 1 && type.OnePersonPrice != 0)
            {
                price = type.OnePersonPrice;
            }
            if (guestCount >= 2 && type.TwoPersonPrice != 0)
            {
                price = type.TwoPersonPrice;
            }
            if (guestCount >= 3 && type.ThreePersonPrice != 0)
            {
                price = type.ThreePersonPrice;
            }
            if (guestCount >= 4 && type.FourPersonPrice != 0)
            {
                price = type.FourPersonPrice;
            }
            return(price);
        }
        public ActionResult Delete(PermissionArea Area, PermissionPost Post, ApType ApType, string Action)
        {
            if (String.IsNullOrWhiteSpace(Action) ||
                !Action.Equals("Yes"))
            {
                return RedirectToAction("View", "Blog", new
                {
                    postid = Post.Entity.ID,
                    title = Post.Entity.Title.ToUrlFriendly()
                });
            }

            middleManagement.Post.Delete(Post.Entity);

            return RedirectToAction("Index", "Blog", new
            {
                page = 1
            });
        }
        private PostEdit GetType(ApType Type)
        {
            PostEdit postEdit;
            switch (Type)
            {
                case ApType.blog:
                    postEdit = new PostEdit
                    {
                        Type = Type.ToProper(),
                        Format = Format.PlainText,
                        Published = true,
                        Promote = true
                    };
                    break;
                default:
                    throw new ArgumentOutOfRangeException("");
            }

            return postEdit;
        }
        public ActionResult Reply(PermissionArea Area, PermissionPost Post, ApType ApType, CommentEdit CommentEdit)
        {
            if (!ModelState.IsValid)
            {
                var postEdit = Mapper.Map<Post, PostEdit>(Post.Entity);

                ViewData["Post"] = postEdit;
                ViewData["Comment"] = CommentEdit;
                ViewData["Salt"] = "CommentReply";

                return View("FormComment", Area);
            }

            var comment = Mapper.Map<CommentEdit, Comment>(CommentEdit);

            var permissionComment = middleManagement.Comment.Add(comment);

            return Redirect(Url.Action("View", "Blog",
                                    new
                                    {
                                        postid = Post.Entity.ID,
                                        title = Post.Entity.Title.ToUrlFriendly()
                                    }) + string.Format("#{0}", permissionComment.Entity.ID));
        }
        public ActionResult Reply(PermissionArea Area, PermissionPost Post, ApType ApType)
        {
            var postEdit = Mapper.Map<Post, PostEdit>(Post.Entity);

            ViewData["Post"] = postEdit;
            ViewData["Comment"] = new CommentEdit();
            ViewData["Salt"] = "CommentReply";

            return View("FormComment", Area);
        }
        public ActionResult Edit(PermissionArea Area, PermissionPost Post, CommentEdit CommentEdit, ApType ApType)
        {
            if (!ModelState.IsValid)
            {
                var postEdit = Mapper.Map<Post, PostEdit>(Post.Entity);

                ViewData["Post"] = postEdit;
                ViewData["Comment"] = CommentEdit;
                ViewData["Salt"] = "PostComment";

                return View("FormComment", Area);
            }

            var commentToSave = Mapper.Map<CommentEdit, Comment>(CommentEdit);
            middleManagement.Comment.Save(commentToSave);

            return RedirectToAction("View", "Blog", new
            {
                postid = Post.Entity.ID,
                title = Post.Entity.Title.ToUrlFriendly()
            });
        }
        public ActionResult Edit(PermissionArea Area, PostEdit PostEdit, ApType ApType)
        {
            if (!ModelState.IsValid)
            {
                ViewData["Post"] = PostEdit;
                ViewData["Salt"] = "PostEdit";

                return View("Form" + ApType.ToProper(), Area);
            }

            var postToSave = Mapper.Map<PostEdit, Post>(PostEdit);

            middleManagement.Post.Save(postToSave);

            return RedirectToAction("View", "Blog", new
            {
                postid = postToSave.ID,
                title = postToSave.Title.ToUrlFriendly()
            });
        }
        public ActionResult Edit(PermissionArea Area, PermissionPost Post, ApType ApType)
        {
            PostEdit postEdit;

            switch (ApType)
            {
                case ApType.blog:
                    postEdit = Mapper.Map<Post, PostEdit>(Post.Entity);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("ApType");
            }

            ViewData["Post"] = postEdit;
            ViewData["Salt"] = "PostEdit";

            return View("Form" + ApType.ToProper(), Area);
        }