public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Timeline timeline = timelineService.GetById((int)id);

            if (timeline == null)
            {
                return(HttpNotFound());
            }
            TimelineViewModel timelineViewModel = new TimelineViewModel()
            {
                TimelineItem = timeline,
                CategoryList = GetCategoryList(timeline.Referee.TournamentId),
                LevelList    = GetLevelList()
            };

            return(View(timelineViewModel));
        }
Exemple #2
0
        public IHttpActionResult Delete(int timelinePostId)
        {
            //first get the timeline post
            var post = _timelineService.GetById(timelinePostId);

            if (post == null)
            {
                return(Response(new { Success = false, Message = "Post doesn't exist" }));
            }

            //only admin or post owner should be able to delete the post
            if (post.OwnerId == _workContext.CurrentCustomer.Id || _workContext.CurrentCustomer.IsAdmin())
            {
                _timelineService.Delete(post);

                return(Response(new { Success = true }));
            }
            return(Response(new { Success = false, Message = "Unauthorized" }));
        }