Exemplo n.º 1
0
        public FileResult DownloadFile(int?fileId, ToDo toDo)
        {
            ToDo     toDoThatIsSaved = new ToDoSelector().GetToDoByLoggedInUserName(toDo.ID);
            ToDoFile toDoFile        = toDoThatIsSaved.ToDoFiles.Where(file => file.ID == fileId).FirstOrDefault();

            return(File(toDoFile.Data, toDoFile.ContentType, toDoFile.Name));
        }
Exemplo n.º 2
0
        public ActionResult MoveToDoDownInPriority(int toDoID, string userName)
        {
            ToDoSelector toDoSelector             = new ToDoSelector();
            ToDo         toDo                     = toDoSelector.GetToDo(toDoID, userName);
            ToDo         nextToDoWithLowerOrderID = new ToDoSelector().
                                                    GetNextToDoThatIsLowerInPriority(toDo.OrderID, toDo.UserName);

            SwapToDosOrderID(nextToDoWithLowerOrderID, toDo);
            return(RedirectToAction(nameof(Index), nameof(ToDo)));
        }
Exemplo n.º 3
0
        public ViewResult FilterByWhatToDo(string whatToDoContainsThis)
        {
            if (whatToDoContainsThis == string.Empty)
            {
                return(Index());
            }

            string userName = new LoggedInUserFinder().GetLoggedInUserName();

            var toDosFound = new ToDoSelector().GetToDosThatIsLikeWhatToDo(whatToDoContainsThis, userName);

            return(View(nameof(Index), toDosFound));
        }
Exemplo n.º 4
0
        public IHttpActionResult Post(int toDoID)
        {
            HttpFileCollection files = HttpContext.Current.Request.Files;

            if (files != null && files.Count > 0)
            {
                HttpPostedFileBase postedFile = new HttpPostedFileWrapper(files[0]);
                ToDo     toDoToUpdate         = new ToDoSelector().GetToDoByLoggedInUserName(toDoID);
                ToDoFile toDoFileToInsert     = new ToDoFileSelector().GetToDoFile(postedFile, toDoID);
                return(new HttpApiController(this).
                       CallPostAction <ToDoFile>(() => new ToDoFileInserter().
                                                 InsertFile(toDoToUpdate, toDoFileToInsert),
                                                 toDoFileToInsert));
            }

            return(BadRequest());
        }
Exemplo n.º 5
0
        public ViewResult Index(int?toDoID)
        {
            ToDo toDoToBeDeleted = new ToDoSelector().GetToDoByLoggedInUserName(toDoID);

            return(View("Index", toDoToBeDeleted));
        }
Exemplo n.º 6
0
        public ViewResult Details(int?toDoID)
        {
            ToDo toDo = new ToDoSelector().GetToDoByLoggedInUserName(toDoID);

            return(View(nameof(Details), toDo));
        }