Ejemplo n.º 1
0
        public GallaryModel GetGallaryId(int Id)
        {
            GallaryModel result = new GallaryModel();


            return(result);
        }
Ejemplo n.º 2
0
        public int UpdateGallary(GallaryModel obj)
        {
            int result = 0;

            result = _gallaryDL.UpdateGallary(obj);
            return(result);
        }
Ejemplo n.º 3
0
        public GallaryModel GetNewsId(int id)
        {
            GallaryModel result = new GallaryModel();

            result = _gallaryDL.GetGallaryId(id);
            return(result);
        }
Ejemplo n.º 4
0
        public int InsertGallary(GallaryModel obj)
        {
            int result = 0;

            result = _gallaryDL.InsertGallary(obj);
            return(result);
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Addbook(BookModel book)
        {
            if (ModelState.IsValid)
            {
                if (book.CoverPhoto != null)
                {
                    string folder = "books/cover/";
                    book.CoverImageURL = await UploadImage(folder, book.CoverPhoto);
                }

                if (book.GallaryFiles != null)
                {
                    string folder = "books/Gallary/";

                    book.Gallary = new List <GallaryModel>();

                    foreach (var file in book.GallaryFiles)
                    {
                        var gallary = new GallaryModel()
                        {
                            Name = file.FileName,
                            URL  = await UploadImage(folder, file)
                        };

                        book.Gallary.Add(gallary);
                    }
                }

                int id = await _bookrepository.AddBook(book);

                if (id > 0)
                {
                    return(RedirectToAction(nameof(Addbook), new { IsSuccess = true, BookId = id }));
                }
            }

            ViewBag.language = new SelectList(await _languagerepository.GetAllLanguages(), "LanguageId", "Name", 1);
            return(View());
        }