Exemple #1
0
 public TodoDetailData GetTodoDetailData([FromRoute] int UserId, [FromRoute] int DataId)
 {
     {
         var data   = _context.TodoDetailDataTmpPgs.Where(x => x.UserId == UserId && x.DataId == DataId);
         var result = Clone.Convert <TodoDetailData>(data);
         return(result);
     }
 }
Exemple #2
0
 public async Task <IActionResult> GetTodoDetailDataUsers([FromRoute] int UserId)
 {
     {
         List <TodoDetailData> result;
         var dataList = _context.TodoDetailDataTmpPgs.Where(x => x.UserId == UserId).ToList();
         result = Clone.Convert <TodoDetailData, TodoDetailDataTmpPg> (dataList);
         return(Ok(result));
     }
 }
Exemple #3
0
 public TodoDetailData TodoDetailDataUpdate([FromBody] TodoDetailData requestData)
 {
     {
         var data = _context.TodoDetailDataTmpPgs.Where(x => x.UserId == requestData.UserId && x.DataId == requestData.DataId);
         foreach (TodoDetailDataTmpPg item in data)
         {
             Clone.Convert(requestData, item);
             _context.Entry(item).State = EntityState.Modified;
         }
         _context.SaveChanges();
         var result = Clone.Convert <TodoDetailData>(data);
         return(result);
     }
 }
Exemple #4
0
        public async Task <IActionResult> TodoDetailDataAdd([FromBody] TodoDetailData requestData)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            {
                var addData = new TodoDetailDataTmpPg();
                Clone.Convert(requestData, addData);
                addData.Id = _context.TodoDetailDataTmpPgs.Max(x => x.Id) + 1;                //最大値に1増やす
                _context.TodoDetailDataTmpPgs.Add(addData);
                _context.SaveChangesAsync();

                return(Ok(requestData));
            }
        }