Inheritance: ICommand
 public ActionResult SetGoal(SetGoal setGoal, int endAfterNumberOfDays)
 {
     setGoal.CreatedOn     = DateTime.Now.Date;
     setGoal.EndOn         = DateTime.Now.AddDays(endAfterNumberOfDays);
     setGoal.IsAchieved    = false;
     setGoal.UserProfileId = WebSecurity.CurrentUserId;
     _goalRepository.Add(setGoal);
     return(RedirectToAction("CreateActivity", "Location"));
 }
Exemple #2
0
 public bool Add(SetGoal goal)
 {
     _db.SetGoals.Add(goal);
     return(_db.SaveChanges() > 0);
 }
 public void When(SetGoal command)
 {
     Update(command.Id, g => g.SetGoal(command.Id, command.Description, command.StartDate, command.LengthOfGoalInDays, command.User));
 }
Exemple #4
0
 public bool Edit(SetGoal goal)
 {
     _db.SetGoals.Attach(goal);
     _db.Entry(goal).State = EntityState.Modified;
     return(_db.SaveChanges() > 0);
 }
 public void When(SetGoal command)
 {
     Update(command.Id, g => g.SetGoal(command.Id, command.Description, command.StartDate, command.LengthOfGoalInDays, command.User));
 }