public int AddUserStory(Common.Models.UserStory userStory)
 {
     Entities.UserStory US = new Entities.UserStory
     {
         Id                 = userStory.Id,
         Name               = userStory.Name,
         UserType           = userStory.UserType,
         Activity           = userStory.Activity,
         BusinessValue      = userStory.BusinessValue,
         AcceptanceCriteria = userStory.AcceptanceCriteria,
         CreatedDate        = DateTime.Now,
         Creator            = userStory.CreatedBy.Id,
         LastModified       = DateTime.Now,
         ModifiedBy         = userStory.ModifiedBy.Id,
         Project            = userStory.Project.Id,
         ApprovalStatus     = userStory.ApprovalStatus
     };
     db.UserStory.Add(US);
     db.SaveChanges();
     return(US.Id);
 }
        public int UpdateUserStory(Common.Models.UserStory userStory)
        {
            Entities.UserStory US = db.UserStory.FirstOrDefault(u => u.Id == userStory.Id);

            US.Id                 = userStory.Id;
            US.Name               = userStory.Name;
            US.UserType           = userStory.UserType;
            US.Activity           = userStory.Activity;
            US.BusinessValue      = userStory.BusinessValue;
            US.AcceptanceCriteria = userStory.AcceptanceCriteria;
            //US.CreatedDate = DateTime.Now;
            US.Creator        = userStory.CreatedBy.Id;
            US.LastModified   = DateTime.Now;
            US.ModifiedBy     = userStory.ModifiedBy.Id;
            US.Project        = userStory.Project.Id;
            US.ApprovalStatus = userStory.ApprovalStatus;

            db.UserStory.Update(US);
            db.SaveChanges();
            return(US.Id);
        }