Пример #1
0
        public TaskFormViewModel(Task task , Sprint sprint , User user, Code  code, Story story)
        {
            TimeforingRepository repo = new TimeforingRepository();
            Task = task;

            Sprint = SelectListMaker.SprintsWithSelected(Task);
            User = SelectListMaker.UsersWithSelected(Task);
            Code = SelectListMaker.CodesWithSelected(Task);
            Story = SelectListMaker.StoriesWithSelected(Task);
        }
Пример #2
0
        public static List<SelectListItem> CodesWithSelected(Code c)
        {
            var items = _repo.FindAllCodes();

            List<SelectListItem> list = new List<SelectListItem>();
            foreach (var item in items)
            {
                SelectListItem i;
                i = new SelectListItem { Value = item.CodeID.ToString(), Text = item.Name, Selected = c.CodeID == item.CodeID };

                list.Add(i);
            }
            return list;
        }
Пример #3
0
        public ActionResult Create(FormCollection collection)
        {
            Code  c = new Code();
            try
            {
                UpdateModel(c);
                repo.AddCode(c );
                repo.Save();

                return RedirectToAction("Index");
            }
            catch (System.Data.SqlClient.SqlException )
            {
                ModelState.AddModelError("ProjectID", "Prosjektnummer finnes ikke");
                return View(c);
            }

            catch
            {
                ModelState.AddRuleViolations(c .GetRuleViolations());
                return View(c);
            }
        }
Пример #4
0
 public CodeFormViewModel(Code code)
 {
     TimeforingRepository repo = new TimeforingRepository ();
     Code = code;
     ProjectCodes = SelectListMaker.Projects();
 }
Пример #5
0
		private void detach_Codes(Code entity)
		{
			this.SendPropertyChanging();
			entity.Project = null;
		}
Пример #6
0
		private void attach_Codes(Code entity)
		{
			this.SendPropertyChanging();
			entity.Project = this;
		}
Пример #7
0
 partial void DeleteCode(Code instance);
Пример #8
0
 partial void UpdateCode(Code instance);
Пример #9
0
 partial void InsertCode(Code instance);
Пример #10
0
 //
 // GET: /Code/Create
 public ActionResult Create()
 {
     Code c =  new Code();
     CodeFormViewModel v = new CodeFormViewModel(c);
     return View(v);
 }