Beispiel #1
0
        public async Task <IHttpActionResult> Post(Entities.Task task)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            await taskobj.Add(task);

            return(Ok("Task Added Successfully"));
        }
Beispiel #2
0
        public void Add()
        {
            var actual = taskBL.Add(new Task
            {
                Id        = 2,
                Title     = "Test task2",
                StartDate = DateTime.Now,
                EndDate   = DateTime.Now
            });

            Assert.AreEqual(2, actual);
        }
        public async System.Threading.Tasks.Task AddTask()
        {
            TaskBL obj   = new TaskBL();
            int    count = obj.GetAll().Count();
            Task   tsk   = new Task {
                TaskName = "Test Task", ParentTaskName = "Test Parent Task", Priority = 2, IsTaskEnded = false, SDate = DateTime.Now, EDate = DateTime.Now.AddDays(2)
            };
            await obj.Add(tsk);

            int count1 = obj.GetAll().Count();

            Assert.AreEqual(count + 1, count1);
        }
Beispiel #4
0
 static void Main(string[] args)
 {
     try
     {
         TaskBL obj = new TaskBL();
         obj.Add(new TaskManager.Entities.Task()
         {
             TaskID   = 2,
             TaskName = "Task2",
             Priority = 13,
             SDate    = DateTime.Now,
             EDate    = DateTime.Now
         });
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         Console.ReadLine();
     }
 }