public void AddDeveloperPosition(DeveloperPositionCreateModel createModel)
        {
            using (IDbConnection dbConnection = Connection)
            {
                dbConnection.Open();
                var trans = dbConnection.BeginTransaction();

                try
                {
                    string sql = @"INSERT INTO DeveloperPosition (DeveloperId, PositionId, Created, CreatedBy)
                                VALUES (@DeveloperId, @PositionId, @Created, @CreatedBy)";

                    dbConnection.Execute(sql, createModel, trans);
                    trans.Commit();
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw new Exception("Something Wrong While Insert DeveloperPosition", ex);
                }
                finally
                {
                    dbConnection.Close();
                }
            }
        }
Example #2
0
 public IActionResult AddDeveloperPosition([FromBody] DeveloperPositionCreateModel createModel)
 {
     _dpService.AddDeveloperPosition(createModel);
     return(Ok(createModel));
 }
Example #3
0
 public void AddDeveloperPosition(DeveloperPositionCreateModel createModel)
 {
     createModel.Created   = _dateTime.Now;
     createModel.CreatedBy = _currentUserService.Username;
     _developerPositionRepository.AddDeveloperPosition(createModel);
 }