public Guid InsertProfessor(ProfessorCreateRequest professor)
        {
            Create();
            Guid ID = Guid.NewGuid();

            using (connection)
            {
                SqlCommand command = new SqlCommand("INSERT INTO  dbo.Professor VALUES(@ID,@CreatedAt,@CreatedBy,@LastUpdatedAt,@LastUpdatedBy,@University,@Department,@Vocation)", connection);
                command.Parameters.Add("@ID", SqlDbType.UniqueIdentifier);
                command.Parameters["@ID"].Value = ID;
                command.Parameters.Add("@University", SqlDbType.VarChar);
                command.Parameters["@University"].Value = professor.University;
                command.Parameters.Add("@Department", SqlDbType.VarChar);
                command.Parameters["@Department"].Value = professor.Department;
                command.Parameters.Add("@Vocation", SqlDbType.VarChar);
                command.Parameters["@Vocation"].Value = professor.Vocation;
                command.Parameters.Add("@LastUpdatedAt", SqlDbType.DateTime);
                command.Parameters["@LastUpdatedAt"].Value = DateTime.Now;
                command.Parameters.Add("@CreatedAt", SqlDbType.DateTime);
                command.Parameters["@CreatedAt"].Value = DateTime.Now;
                command.Parameters.Add("@LastUpdatedBy", SqlDbType.VarChar);
                command.Parameters["@LastUpdatedBy"].Value = "ivona";
                command.Parameters.Add("@CreatedBy", SqlDbType.VarChar);
                command.Parameters["@CreatedBy"].Value = "ivona";

                command.ExecuteNonQuery();
                connection.Close();
            }

            return(ID);
        }
        public ProfessorResponse Create(ProfessorCreateRequest request)
        {
            Guid ID       = _professorDao.InsertProfessor(request);
            var  response = new ProfessorResponse(_userService.Create(request, ID), ID, request.University, request.Department, request.Vocation);

            return(response);
        }
Exemple #3
0
 public ProfessorResponse Create(ProfessorCreateRequest request)
 {
     return(_professorService.Create(request));
 }