コード例 #1
0
 //Vložení nového záznamu bugu
 public int?AddBug(BugModel bug)
 {
     using (IDbConnection db = new SqlConnection(ConnectionString))
     {
         bug.Status   = "Nový";
         bug.Labels   = string.Join(",", bug.LabelsString);
         bug.Assigned = string.Join(",", bug.AssignedString);
         return(db.Insert(bug));
     }
 }
コード例 #2
0
        //Aktualizace bugu
        public int?UpdateBug(BugModel bug)
        {
            using (IDbConnection db = new SqlConnection(ConnectionString))
            {
                const string quote = "\"";
                bug.Labels   = string.Join(",", bug.LabelsString);
                bug.Assigned = string.Join(",", bug.AssignedString);
                string query = @"update tbBug SET name = @name, description = @description, priority = @priority, labels = @labels, assigned = @assigned, " + quote + "end" + quote + " = @end where Id = @bugid";

                var result = db.Execute(query, new
                {
                    name        = bug.Name,
                    description = bug.Description,
                    status      = bug.Status,
                    priority    = bug.Priority,
                    labels      = bug.Labels,
                    assigned    = bug.Assigned,
                    end         = bug.End,
                    bugid       = bug.Id
                });

                return(result);
            }
        }