public async Task <IActionResult> Save([FromForm] Musteri musteri) { try { musteri.FirmaId = HttpContext.Session.GetInt32(Metrics.SessionKeys.FirmaId).Value; musteri.CreatorId = HttpContext.Session.GetInt32(Metrics.SessionKeys.UserId).Value; musteri.Kullanici.RolId = await _rolService.MusteriRolId(); if (musteri.Id == 0) { musteri.KullaniciId = await _kullaniciService.Save(musteri.Kullanici); musteri.Kullanici = null; await _musteriService.Save(musteri); } else { var model = await _musteriService.Get(musteri.Id, musteri.FirmaId.Value); musteri.Kullanici.Id = model.KullaniciId; musteri.KullaniciId = model.KullaniciId; await _kullaniciService.Update(musteri.Kullanici); await _musteriService.Update(musteri); } return(Json(true)); } catch (Exception e) { return(Json(false)); } }