コード例 #1
0
        public async Task <IActionResult> TimeSheet(int id, DateTime Start, DateTime End, String Complete, int ID = 0)
        {
            string user        = User.FindFirst("Index").Value;
            var    Currentuser = await _taskRepository.GetCurrentUser(user);

            ViewBag.photo  = Currentuser.PhotoURL;
            ViewBag.EmpId  = Currentuser.EmpId;
            ViewBag.TaskId = ID;

            if (ID != 0)
            {
                await _taskRepository.AddTaskFromList(ID);
            }
            if (Start != DateTime.MinValue && End != DateTime.MinValue)
            {
                await _taskRepository.TImeSheetTaskInsert(id, Start, End);

                await _taskRepository.StatusUpdate(ViewBag.EmpId, Start);

                await _Repository2.AddCost(id, Start, End);

                if (Complete == "Complete")
                {
                    await _taskRepository.CompleteTask(id);
                }
                if (Complete == "NotComplete")
                {
                    await _taskRepository.NotCompleteTask(id);
                }
                return(RedirectToAction(nameof(TimeSheet), new { ID = 0 }));
            }
            var data = await _taskRepository.AddTaskList(ViewBag.EmpId);

            return(View(data));
        }