예제 #1
0
        public async Task <IActionResult> CreateClientsLogo(IFormFile file)
        {
            if (file != null)
            {
                var entity = new ClientsLogo()
                {
                    ImageUrl = file.FileName
                };

                var path = Path.Combine(Directory.GetCurrentDirectory(), @"wwwroot\img\about\partners", file.FileName);
                using (var stream = new FileStream(path, FileMode.Create))
                    await file.CopyToAsync(stream);

                if (_clientsLogoService.Create(entity))
                {
                    ToastrService.AddToUserQueue(new Toastr()
                    {
                        Message    = Toastr.GetMessage("Partner Logosu"),
                        Title      = Toastr.GetTitle("Logo"),
                        ToastrType = ToastrType.Success
                    });

                    return(RedirectToAction("ClientsLogoList"));
                }
            }

            ViewBag.ErrorMessage = _clientsLogoService.ErrorMessage;
            return(RedirectToAction("ClientsLogoList"));
        }
예제 #2
0
        public bool Validate(ClientsLogo entity)
        {
            var isValid = true;

            if (string.IsNullOrEmpty(entity.ImageUrl))
            {
                ErrorMessage += "Bir Resim Seçmelisiniz.";
                isValid       = false;
            }

            return(isValid);
        }
예제 #3
0
 public bool Create(ClientsLogo entity)
 {
     if (Validate(entity))
     {
         _clientsLogoDal.Create(entity);
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #4
0
 public void Update(ClientsLogo entity)
 {
     _clientsLogoDal.Update(entity);
 }
예제 #5
0
 public void Delete(ClientsLogo entity)
 {
     _clientsLogoDal.Delete(entity);
 }