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")); }
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)); }
public bool Edit(SetGoal goal) { _db.SetGoals.Attach(goal); _db.Entry(goal).State = EntityState.Modified; return(_db.SaveChanges() > 0); }