Beispiel #1
0
		/// <summary>
		///     Initializes a new instance.
		/// </summary>
		/// <param name="model">The model that should be checked.</param>
		public Spin(Model model)
		{
			Requires.NotNull(model, () => model);

			_model = model;
			_model.Seal();

			var transformedModel = ModelTransformation.Transform(_model);
			Console.WriteLine(ScmToString.ToString(transformedModel.Item));

			_analysis = new AnalysisContext(transformedModel);
		}
 public ActionResult Create(Model<Todo> todo)
 {
     if (todo.IsValid)
     {
         // create
         // repository.Add(todo.Value);
         return new ContentNegotiatedResult<Todo>(todo.Value) { StatusCode = HttpStatusCode.Created }; //{ RedirectTarget = Urls.View };
     }
     else
     {
         return new ContentNegotiatedResult<Todo>(todo.Value) { StatusCode = HttpStatusCode.BadRequest };
     }
 }
 public ActionResult Update(Model<Todo> todo)
 {
     if (todo.IsValid)
     {
         // update
         // repository.Update(todo.Value);
         return new ContentNegotiatedResult<Todo>(todo.Value); //{ RedirectTarget = Urls.View };
     }
     else
     {
         return new ContentNegotiatedResult<Todo>(todo.Value)
                    {
                         StatusCode = HttpStatusCode.BadRequest, RedirectBrowserTo = Urls.Edit.Get(1)
                    };
     }
 }
		/// <summary>
		///   Transforms the <paramref name="model" />.
		/// </summary>
		/// <param name="model">The model that should be transformed.</param>
		public static Scm.ScmModel Transform(Model model)
		{
			Requires.NotNull(model, () => model);
			return Scm.ScmModel.NewScmModel(SsmToScm.Transform(SsmLowering.Lower(Transform(model.Metadata.RootComponent))));
		}