public JsonResult CreateActivityLog(ActivityLogModel model)
        {
            var dm = new JourListDMContainer();
            var log = new ActivityLog();
            var member = dm.Members.SingleOrDefault(z => z.Name == User.Identity.Name);
            if (member == null)
                return JsonError("You don't exist");

            var journal = member.Journals.Single(z => z.Id == model.JourId);
            if (journal == null)
                return JsonError("This journal doesn't belong to you");

            log.Activity = dm.Activities.Single(z => z.Id == model.ActId);
            log.Quantity = model.Quantity;
            // TODO: Hyperlink & Notes should be updated to default to an
            //       empty string in the databaseif the value are null,
            //       the EM has been updated, but the database needs to
            //       be updated to reflect the default value of "".
            log.Notes = model.Notes;
            log.Hyperlink = model.Hyperlink;
            log.Unit = dm.Units.Single(z => z.Id == model.UnitId);
            log.Journal = journal;
            dm.ActivityLogs.AddObject(log);
            dm.SaveChanges();
            //            model.Points = log.Activity.Points;
            //            model.TotalPoints = (int)Math.Round(log.Activity.Points * log.Quantity);
            model.LogId = log.Id;
            //            return Json(model);
            return Json(new { Result = "OK", Record = model });
            //            return JsonError("Not Done");
        }
 /// <summary>
 /// Create a new ActivityLog object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static ActivityLog CreateActivityLog(global::System.Int64 id)
 {
     ActivityLog activityLog = new ActivityLog();
     activityLog.Id = id;
     return activityLog;
 }
 private void set(ActivityLog log, Activity act)
 {
     if (log != null)
     {
         this.LogId = log.Id;
         this.Quantity = log.Quantity;
         this.unitid = log.Unit.Id;
         this.UnitList = new SelectList(log.Unit.UnitType.Units, "Id", "Description", this.sUnitId);
         this.Hyperlink = log.Hyperlink;
         this.Notes = log.Notes;
         this.Description = log.Activity.Description;
         this.JourId = log.Journal.Id;
      //               this.TotalPoints = (int)(act.Points * log.Quantity);
     }
     else
     {
         this.unitid = act.Unit.Id;
         this.UnitList = new SelectList(act.Unit.UnitType.Units, "Id", "Description", this.sUnitId);
     }
     this.ActId = act.Id;
     this.Description = act.Description;
     //            this.Points = act.Points;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the ActivityLogs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToActivityLogs(ActivityLog activityLog)
 {
     base.AddObject("ActivityLogs", activityLog);
 }