public async Task <IActionResult> Save(KiralamaDto kiralamaDto)
        {
            try
            {
                string sql   = @"
                    INSERT INTO
                        Kiralama
                            (AliciID, ArabaID, BaslangicTarihi, BitisTarihi)
                    VALUES
                        (@AliciID, @ArabaID, @BaslangicTarihi, @BitisTarihi)
                ";
                object param = new
                {
                    AliciID         = kiralamaDto.AliciID,
                    ArabaID         = kiralamaDto.ArabaID,
                    BaslangicTarihi = kiralamaDto.BaslangicTarihi,
                    BitisTarihi     = kiralamaDto.BitisTarihi
                };
                await _dapperKiralamaService.ExecuteAsync(sql, param);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(NotFound(ex.Message));
            }
        }
Пример #2
0
        public async Task <IActionResult> Save(FirmaDto firmaDto)
        {
            try
            {
                string sql   = @"
                    INSERT INTO
                        Firma
                            (Unvan, Telefon, Mail, Adres, VergiNo)
                    VALUES
                        (@Unvan, @Telefon, @Mail, @Adres, @VergiNo)
                ";
                object param = new
                {
                    Unvan   = firmaDto.Unvan,
                    Telefon = firmaDto.Telefon,
                    Mail    = firmaDto.Mail,
                    Adres   = firmaDto.Adres,
                    VergiNo = firmaDto.VergiNo
                };
                await _dapperFirmaService.ExecuteAsync(sql, param);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(NotFound(ex.Message));
            }
        }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public async Task <bool> Add(TestModel model)
 {
     return(await dapper.ExecuteAsync <int>(SQL_Insert, new
     {
         model.Description
     }) > 0);
 }