Example #1
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 }));
     }
 }
Example #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 }));
        }