Ejemplo n.º 1
0
        public AddNewItemResponse Post(JobModel job)
        {
            var userFavouriteJob = new UserFavouriteJob
            {
                UserId   = User.Identity.Name,
                JobId    = job.Id,
                Title    = job.Title,
                Category = job.Category,
                Url      = job.Url
            };



            favouriteJobsData.Add(userFavouriteJob);
            favouriteJobsData.Commit();

            var response = new AddNewItemResponse()
            {
                success  = true,
                addedJob = userFavouriteJob
            };


            return(response);
        }
Ejemplo n.º 2
0
        public IActionResult DeleteFavourite(int jobId)
        {
            favouriteJobsData.Delete(jobId, User.Identity.Name);

            favouriteJobsData.Commit();

            return(RedirectToAction("Index"));
        }