コード例 #1
0
 public JsonResult <List <BookMasterViewModel> > GetAllBookMasterData(BookMasterViewModel objMasterBookModel)
 {
     try
     {
         var record = _iBookMaster.GetAllBookMasterData(objMasterBookModel);
         return(Json(record));
     }
     catch (Exception ex)
     {
         Common.MyLogger.Error(ex.Message + ex.StackTrace + ex.InnerException.ToString());
         return(null);
     }
 }
コード例 #2
0
        /// <summary>
        /// GetBy Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <BookMasterViewModel> GetById(int id)
        {
            var masterTable = new BookMasterViewModel();

            using (var client = Common.GetHttpClient())
            {
                var Response = await client.GetAsync(AdminConstants.BOOKMASTER_API_GET + "?id=" + id);

                if (Response.IsSuccessStatusCode)
                {
                    return(JsonConvert.DeserializeObject <BookMasterViewModel>(Response.Content.ReadAsStringAsync().Result));
                }
                return(null);
            }
        }
コード例 #3
0
        /// <summary>
        /// Get All RoomMaster Data
        /// </summary>
        /// <param name="objBookMasterTableModel"></param>
        /// <returns></returns>
        public List <BookMasterViewModel> GetAllBookMasterData(BookMasterViewModel objBookMasterModel)
        {
            List <BookMasterViewModel> getRoomMasterTableModelList = new List <BookMasterViewModel>();

            GEEDbContext context = new GEEDbContext();


            var _roomMasterTableData = (from mstTbl in context.BookMasters
                                        where mstTbl.IsDeleted != true
                                        select new
            {
                mstTbl.BookMaster_Id,
                mstTbl.Code,
                mstTbl.name,
                mstTbl.Publisher,
                mstTbl.ISBN,
                mstTbl.MRP,
                mstTbl.Version,
                mstTbl.Discount
            });


            //Sorting
            if (!(string.IsNullOrEmpty(objBookMasterModel.SortColumn) && string.IsNullOrEmpty(objBookMasterModel.SortOrder)))
            {
                _roomMasterTableData = _roomMasterTableData.OrderBy(objBookMasterModel.SortColumn + " " + objBookMasterModel.SortOrder);
            }
            int recordsTotal = _roomMasterTableData.Count();
            var data         = _roomMasterTableData.Skip(objBookMasterModel.PageNo).Take(objBookMasterModel.PageSize).ToList();

            foreach (var item in data)
            {
                BookMasterViewModel objBookMaster = new BookMasterViewModel();
                objBookMaster.BookMaster_Id = item.BookMaster_Id;
                objBookMaster.Code          = item.Code;
                objBookMaster.name          = item.name;
                objBookMaster.Publisher     = item.Publisher;
                objBookMaster.ISBN          = item.ISBN;
                objBookMaster.MRP           = item.MRP;
                objBookMaster.Version       = item.Version;
                objBookMaster.Discount      = item.Discount;

                objBookMaster.RowCount = recordsTotal;
                getRoomMasterTableModelList.Add(objBookMaster);
            }

            return(getRoomMasterTableModelList);
        }
コード例 #4
0
        public async Task <ActionResult> Edit(BookMasterViewModel collection)
        {
            try
            {
                collection.ModifiedDate = DateTime.Now;
                collection.CreatedDate  = DateTime.Now;
                var stringContent = new StringContent(JsonConvert.SerializeObject(collection).ToString(), Encoding.UTF8, "application/json");
                var status        = await service.Update(stringContent);

                return(new JsonResult {
                    Data = new { status = status }
                });
            }
            catch
            {
                return(View());
            }
        }