public async Task <IActionResult> CreateAsync(ProjectCreateInputModel input) { if (!this.ModelState.IsValid) { return(this.View(input)); } var user = await this.userManager.GetUserAsync(this.User); var imageUrls = await CloudinaryExtension.UploadMultipleAsync(this.cloudinary, input.Pictures); int projectId = await this.projectsService.CreateAsync(input.CategoryId, input.Content, input.Title, input.ProjectStatus, input.Progress, user.Id, imageUrls); return(this.RedirectToAction("ById", new { id = projectId })); }
public async Task <IActionResult> CreateAsync(LocationsCreateInputModel input) { if (!this.ModelState.IsValid) { return(this.View(input)); } var user = await this.userManager.GetUserAsync(this.User); var imageUrls = await CloudinaryExtension.UploadMultipleAsync(this.cloudinary, input.Pictures); string latinName = Transliteration.CyrillicToLatin(input.Name, Language.Bulgarian); latinName = latinName.Replace(' ', '-'); _ = await this.locationsService.CreateAsync(input.Name, input.Description, input.Adress, input.PhoneNumber, input.Email, input.Website, input.FacebookPage, input.InstagramPage, user.Id, input.MapLink, input.Perks, input.Type, imageUrls, latinName); return(this.RedirectToAction("ByName", new { name = latinName })); }
public async Task <IActionResult> CreateAsync(NewsCreateInputModel input) { if (!this.ModelState.IsValid) { return(this.View(input)); } var user = await this.userManager.GetUserAsync(this.User); var imageUrls = await CloudinaryExtension.UploadMultipleAsync(this.cloudinary, input.Pictures); string latinTitle = Transliteration.CyrillicToLatin(input.Title, Language.Bulgarian); latinTitle = latinTitle.Replace(' ', '-'); _ = await this.newsService.CreateAsync(input.Title, input.Content, user.Id, imageUrls, latinTitle, input.Author); return(this.RedirectToAction("ByName", new { name = latinTitle })); }
public async Task <IActionResult> Edit(LocationsEditViewModel locationToEdit) { var user = await this.userManager.GetUserAsync(this.User); var imageUrls = new List <string>(); if (locationToEdit.Pictures != null) { imageUrls = await CloudinaryExtension.UploadMultipleAsync(this.cloudinary, locationToEdit.Pictures); } string latinName = Transliteration.CyrillicToLatin(locationToEdit.Name, Language.Bulgarian); latinName = latinName.Replace(' ', '-'); await this.locationsService.EditAsync(locationToEdit.Name, locationToEdit.Description, locationToEdit.Adress, locationToEdit.PhoneNumber, locationToEdit.Email, locationToEdit.Website, locationToEdit.FacebookPage, locationToEdit.InstagramPage, user.Id, locationToEdit.MapLink, locationToEdit.Perks, locationToEdit.Type, imageUrls, latinName, locationToEdit.Id); return(this.RedirectToAction("ByName", new { name = latinName })); }
public async Task <IActionResult> Edit(NewsEditViewModel newsPostToEdit) { var user = await this.userManager.GetUserAsync(this.User); var imageUrls = new List <string>(); if (newsPostToEdit.Pictures != null) { imageUrls = await CloudinaryExtension.UploadMultipleAsync(this.cloudinary, newsPostToEdit.Pictures); } string latinTitle = Transliteration.CyrillicToLatin(newsPostToEdit.Title, Language.Bulgarian); latinTitle = latinTitle.Replace(' ', '-'); await this.newsService.EditAsync(newsPostToEdit.Title, newsPostToEdit.Content, user.Id, imageUrls, latinTitle, newsPostToEdit.Author, newsPostToEdit.Id); return(this.RedirectToAction("ByName", new { name = latinTitle })); }