コード例 #1
0
ファイル: KpiTargetController.cs プロジェクト: yhsantosa/Pear
 public JsonResult KpiTargetItem(KpiTargetItem kpiTarget)
 {
     if (kpiTarget.Id > 0)
     {
         var request  = kpiTarget.MapTo <UpdateKpiTargetItemRequest>();
         var response = _kpiTargetService.UpdateKpiTargetItem(request);
         return(Json(new { Id = response.Id, Message = response.Message, isSuccess = response.IsSuccess }));
     }
     else
     {
         var request  = kpiTarget.MapTo <CreateKpiTargetRequest>();
         var response = _kpiTargetService.Create(request);
         return(Json(new { Id = response.Id, Message = response.Message, isSuccess = response.IsSuccess }));
     }
 }
コード例 #2
0
        public JsonResult KpiTargetItem(KpiTargetItem kpiTarget)
        {
            /*if (kpiTarget.Id > 0)
             * {
             *  var request = kpiTarget.MapTo<UpdateKpiTargetItemRequest>();
             *  var response = _kpiTargetService.UpdateKpiTargetItem(request);
             *  return Json(new { Id = response.Id, Message = response.Message, isSuccess = response.IsSuccess });
             * }
             * else
             * {
             *  var request = kpiTarget.MapTo<CreateKpiTargetRequest>();
             *  var response = _kpiTargetService.Create(request);
             *  return Json(new { Id = response.Id, Message = response.Message, isSuccess = response.IsSuccess });
             * }*/

            var request = kpiTarget.MapTo <UpdateKpiTargetItemRequest>();

            request.UserId = this.UserProfile().UserId;
            var response = _kpiTargetService.UpdateKpiTargetItem(request);

            return(Json(new { Id = response.Id, Message = response.Message, isSuccess = response.IsSuccess }));
        }