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")); }
public bool Validate(ClientsLogo entity) { var isValid = true; if (string.IsNullOrEmpty(entity.ImageUrl)) { ErrorMessage += "Bir Resim Seçmelisiniz."; isValid = false; } return(isValid); }
public bool Create(ClientsLogo entity) { if (Validate(entity)) { _clientsLogoDal.Create(entity); return(true); } else { return(false); } }
public void Update(ClientsLogo entity) { _clientsLogoDal.Update(entity); }
public void Delete(ClientsLogo entity) { _clientsLogoDal.Delete(entity); }