Beispiel #1
0
        public ActionResult SaveData(StationChangeViewModel stations)
        {
            if (stations.updated != null)
            {
                foreach (var updated in stations.updated)
                {
                    _stationService.Update(updated);
                }
            }
            if (stations.deleted != null)
            {
                foreach (var deleted in stations.deleted)
                {
                    _stationService.Delete(deleted);
                }
            }
            if (stations.inserted != null)
            {
                foreach (var inserted in stations.inserted)
                {
                    _stationService.Insert(inserted);
                }
            }
            _unitOfWork.SaveChanges();

            return(Json(new { Success = true }, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
 public ActionResult Delete(string id)
 {
     try
     {
         var result = iStation.Delete(id);
         return(Json(new
         {
             ErrorCode = result.ErrorCode,
             Message = result.Msg,
             Id = result.Id,
             JsonRequestBehavior.AllowGet
         }));
     }
     catch (Exception ex)
     {
         return(Json(new { ErrorCode = 1, Message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }