Пример #1
0
        public async Task <ActionResult> Create(MasterSlider model)
        {
            try
            {
                //byte[] bytes = System.Convert.FromBase64String(model.Photo);

                SliderRepository Repository  = new SliderRepository();
                string           ImageLoc    = model.Photo;
                string           ImageNewLoc = ImageLoc.Remove(0, 12);
                string           ImageName   = FilePath.FilePathSlider + ImageNewLoc;
                var result = await Repository.CreateSlider(ImageName, model.Judul, model.DesSingkat, model.DesPanjang, User.Identity.Name);

                if (result == true)
                {
                    return(await GetList());
                }
                else
                {
                    return(View(result));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
                return(View(false));
            }
        }