Beispiel #1
0
 /// <summary>
 /// Decode day record row from database to initial view
 /// </summary>
 /// <param name="dayBooks"></param>
 /// <returns></returns>
 private List <DayBookModel> DectyptRecords(List <DayBookModel> dayBooks)
 {
     for (int i = 0; i < dayBooks.Count; i++)
     {
         dayBooks[i].DayRecord = Transposition.GetDecryptedString(dayBooks[i].DayRecord);
     }
     return(dayBooks);
 }
Beispiel #2
0
        // GET: DayBooks/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DayBookModel dayBook = await db.DayBooks.FindAsync(id);

            dayBook.DayRecord = Transposition.GetDecryptedString(dayBook.DayRecord);
            if (dayBook == null)
            {
                return(HttpNotFound());
            }
            return(View(dayBook));
        }
Beispiel #3
0
        /// <summary>
        /// Get record details and show full data description which all images
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DayRecordViewModel viewModel = new DayRecordViewModel();
            DayBookModel       dayBook   = await db.DayBooks.FindAsync(id);

            var Images = db.ImageModels.Where(p => p.DayBookModelId == dayBook.DayBookModelId);

            viewModel.DayRecord   = Transposition.GetDecryptedString(dayBook.DayRecord);
            viewModel.ImageModels = await db.ImageModels.Where(p => p.DayBookModelId.Equals(dayBook.DayBookModelId)).ToListAsync();;

            if (dayBook == null)
            {
                return(HttpNotFound());
            }

            return(View(viewModel));
        }