public IActionResult Testsub(ArtistSetings artistSetings) { var idUser = aartistRepository.GetIdUserByUsurName(User.Identity.Name); //creat artist if (aartistRepository.IfArtisCreated(idUser) == false) { var citys = JsonConvert.DeserializeObject <List <Citys> >(artistSetings.Citys); var newIdArtit = aartistRepository.AddArtist(new Artist { IdUser = idUser, ArtistType = (Enums.ArtistType)artistSetings.TypeArtist, EventType = (Enums.EventType)artistSetings.TypeEvent, Price = artistSetings.Price, }); artistSetings.DaysWork.IdArtit = newIdArtit; aartistRepository.AddDaysWork(artistSetings.DaysWork); aartistRepository.AddCictyWorks(citys, newIdArtit); } //edit artisi else { var artist = aartistRepository.GetArtitByIdUser(idUser); artist.ArtistType = (Enums.ArtistType)artistSetings.TypeArtist; artist.EventType = (Enums.EventType)artistSetings.TypeEvent; artist.Price = artistSetings.Price; aartistRepository.EditArtist(artist); artistSetings.DaysWork.IdArtit = artist.Id; var dayWork = aartistRepository.GetByIdArtist(artist.Id); dayWork.Friday = artistSetings.DaysWork.Friday; dayWork.Monday = artistSetings.DaysWork.Monday; dayWork.Sunday = artistSetings.DaysWork.Sunday; dayWork.Thursday = artistSetings.DaysWork.Thursday; dayWork.Tuesday = artistSetings.DaysWork.Tuesday; dayWork.Wednesday = artistSetings.DaysWork.Wednesday; aartistRepository.EditDaysWork(dayWork); var citys = JsonConvert.DeserializeObject <List <Citys> >(artistSetings.Citys); aartistRepository.DeleteAllCityWorkByIdArtist(artist.Id); aartistRepository.AddCictyWorks(citys, artist.Id); } return(View("ArtistCard", artistSetings)); }