Пример #1
0
 internal static void MarkNotIsNew(Task item)
 {
     item.IsNew = false;
     if (item.Logs != null)
     {
         foreach (var log in item.Logs)
         {
             TaskLogBF.MarkNotIsNew(log);
         }
     }
 }
Пример #2
0
        internal Task FetchAndUpdate(Task item)
        {
            Task fetched = Get(item.ID);

            fetched.Title    = item.Title;
            fetched.IsActive = item.IsActive;
            fetched.TaskType = item.TaskType;

            if (item.Comments != null)
            {
                foreach (var comment in item.Comments)
                {
                    if (comment.ID <= 0)
                    {
                        fetched.Comments.Add(comment);
                    }
                    else
                    {
                        fetched.Comments.Where(c => c.ID == comment.ID).Single().Comment = comment.Comment;
                    }
                }
            }

            if (item.Logs != null)
            {
                TaskLogBF bf = new TaskLogBF(db);
                foreach (var log in item.Logs)
                {
                    if (log.ID <= 0)
                    {
                        fetched.Logs.Add(log);
                    }
                    else
                    {
                        var temp = fetched.Logs.Where(l => l.ID == log.ID).Single();
                        temp = bf.FetchAndUpdate(log);
                    }
                }
            }

            MarkNotIsNew(fetched);
            return(fetched);
        }