Esempio n. 1
0
        public JsonResult EditWatchList(WatchListModel watchListModel)
        {
            // Set the date of creation and modification.
            if (watchListModel.WatchListID > 0)
            {
                watchListModel.ModifiedOn = DataFormatter.FormatDateToString(DateTime.Now);
            }
            else
            {
                watchListModel.CreatedOn = DataFormatter.FormatDateToString(DateTime.Now);
            }

            // Save the changes and return new grid model as JSON result if the save is successful.
            this.SaveWatchListItem(watchListModel);

            return(Json(this.CreateWatchListGridModel(new GridContext {
                SortInfo = new GridSortInfo {
                    SortOn = "Name"
                }
            })));
        }
Esempio n. 2
0
 /// <summary>
 /// Converts a WatchListEntity to WatchListModel.
 /// </summary>
 /// <param name="watchListEntity">WatchListEntity to be converted to WatchListModel.</param>
 /// <returns>WatchListModel corresponding to WatchListEntity.</returns>
 public static WatchListModel ConvertWatchListEntityToModel(WatchListEntity watchListEntity)
 {
     return(new WatchListModel
     {
         AlertRequired = watchListEntity.AlertRequired,
         AltNameOne = watchListEntity.AltNameOne,
         AltNameThree = watchListEntity.AltNameThree,
         AltNameTwo = watchListEntity.AltNameTwo,
         BseSymbol = watchListEntity.BseSymbol,
         CreatedOn = (watchListEntity.CreatedOn != null)
                                    ? DataFormatter.FormatDateToString(DataFormatter.GetDateTimeInLocalFormat(watchListEntity.CreatedOn))
                                    : null,
         IsActive = watchListEntity.IsActive,
         ModifiedOn = (watchListEntity.ModifiedOn != null)
                                     ? DataFormatter.FormatDateToString(DataFormatter.GetDateTimeInLocalFormat(watchListEntity.ModifiedOn))
                                     : null,
         Name = watchListEntity.Name,
         NseSymbol = watchListEntity.NseSymbol,
         TempName = watchListEntity.TempName,
         WatchListID = watchListEntity.WatchListID
     });
 }