예제 #1
0
        public static Task ToTask(TaskPostModel task)
        {
            if (task.Importance == "Medium")
            {
            }
            else if (task.Importance == "High")
            {
            }
            if (task.Status == "In_Progress")
            {
            }
            else if (task.Status == "Closed")
            {
            }

            return(new Task
            {
                Title = task.Title,
                Description = task.Description,
                DateTimeAdded = task.DateTimeAdded,
                Deadline = task.Deadline,
                Importance = task.Importance,
                Status = task.Status,
                DateTimeClosedAt = task.DateTimeClosedAt,
                Comments = task.Comments
            });
        }
예제 #2
0
        public static Task ToTask(TaskPostModel task)
        {
            //va trebui sa imi "calculez" enumurile : cazul meu importance si status
            //pentru importance
            //Importance importance = Models.Importance.Low;
            //if (task.Importance == "Medium")
            //{
            //    importance = Models.Importance.Medium;
            //}
            //else if(task.Importance == "High")
            //{
            //    importance = Models.Importance.High;
            //}

            ////pentru status
            //Status status= Models.Status.Open;
            //if (task.Status == "In_Progress")
            //{
            //    status = Models.Status.In_progress;
            //}
            //else if(task.Status == "Closed")
            //{
            //    status = Models.Status.Closed;
            //}

            return(new Task
            {
                Title = task.Title,
                Description = task.Description,
                DateTimeAdded = task.DateTimeAdded,
                Deadline = task.Deadline,
                Importance = task.Importance,
                Status = task.Status,
                DateTimeClosedAt = task.DateTimeClosedAt
            });
        }