예제 #1
0
 public void UpdateItem(Task t)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository<Task>();
         rep.Update(t);
     }
 }
예제 #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var t = new Task();
            var tc = new TaskController();

            if (ItemId > 0)
            {
                t = tc.GetItem(ItemId, UserId);
                t.Title = txtName.Text.Trim();
                t.Description = txtDescription.Text.Trim();
                t.LastModifiedByUserId = UserId;
                t.LastModifiedOnDate = DateTime.Now;
                t.AssignedUserId = Convert.ToInt32(ddlAssignedUser.SelectedValue);
            }
            else
            {
                t = new Task()
                {
                    AssignedUserId = Convert.ToInt32(ddlAssignedUser.SelectedValue),
                    CreatedByUserId = UserId,
                    CreatedOnDate = DateTime.Now,
                    Title = txtName.Text.Trim(),
                    Description = txtDescription.Text.Trim(),

                };
            }

            t.LastModifiedOnDate = DateTime.Now;
            t.LastModifiedByUserId = UserId;

            if (t.TaskId > 0)
            {
                tc.UpdateItem(t);
            }
            else
            {
                tc.CreateItem(t);
            }
            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
        }