本文整理匯總了C#中System.Web.Mvc.FormCollection.Add方法的典型用法代碼示例。如果您正苦於以下問題:C# FormCollection.Add方法的具體用法?C# FormCollection.Add怎麽用?C# FormCollection.Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Web.Mvc.FormCollection
的用法示例。
在下文中一共展示了FormCollection.Add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MailerFormValues
private NameValueCollection MailerFormValues()
{
var form = new FormCollection();
form.Add("name", "name");
form.Add("FromAddress", "[email protected]");
form.Add("Body", "Hello world!");
return form;
}
示例2: CreateUserForm
public FormCollection CreateUserForm()
{
var form = new FormCollection();
form.Add("User", "user");
form.Add("FirtsName", "first");
form.Add("LastName", "last");
form.Add("Email", "[email protected]");
form.Add("RoleIds", "1,2");
return form;
}
示例3: CreateDinnerFormCollection
public static FormCollection CreateDinnerFormCollection()
{
var form = new FormCollection();
form.Add("Description", "Description");
form.Add("Title", "New Test Dinner");
form.Add("EventDate", "2010-02-14");
form.Add("Address", "5 Main Street");
form.Add("ContactPhone", "503-555-1212");
return form;
}
示例4: EditServiceOrderTest
public void EditServiceOrderTest()
{
string userName = "adminGlobal";
FormCollection formCollection = new FormCollection();
formCollection.Add("Client", "BB4439C8-E0CA-4725-8108-56C788495ACB");
formCollection.Add("BookingNumber", "");
formCollection.Add("OrderNumber", "");
List<BusinessApplicationByUser> businessApplicationsByUser = AuthorizationBusiness.GetBusinessApplicationsByUser(userName);
Guid businessApplicationId = businessApplicationsByUser.FirstOrDefault().Id;
Guid serviceOrderId = new Guid("B2F4184A-B1A6-434F-948A-BCF17F1D4FEE");
ServiceOrderBusiness.EditServiceOrder(formCollection, businessApplicationId, userName, serviceOrderId);
}
示例5: Recalc_With_VendorCoupon
public void Recalc_With_VendorCoupon()
{
var m_Controller = CreateController<ERPStore.Controllers.CartController>();
m_Controller.AddCartItem("XBOX360");
var formCollection = new FormCollection();
formCollection.Add("quantity", "5");
formCollection.Add("couponcode", "Vendor1");
var result = (System.Web.Mvc.ViewResult)m_Controller.Recalc(formCollection);
var cart = result.ViewData.Model as ERPStore.Models.OrderCart;
Assert.IsNotNull(cart);
Assert.IsNotNull(cart.Coupon);
Assert.AreEqual(cart.Coupon.Type, ERPStore.Models.CouponType.VendorCode);
Assert.AreEqual(result.ViewName, "Index");
}
示例6: TestInitialize
public void TestInitialize()
{
fakeform = new FormCollection();
fakeform.Add("ID", testid.ToString());
fakeform.Add("workSiteAddress1", "blah"); //Every required field must be populated,
fakeform.Add("city", "UnitTest"); //or result will be null.
fakeform.Add("state", "WA");
fakeform.Add("phone", "123-456-7890");
fakeform.Add("zipcode", "12345-6789");
fakeform.Add("typeOfWorkID", "1");
fakeform.Add("dateTimeofWork", "1/1/2011");
fakeform.Add("transportMethodID", "1");
fakeform.Add("transportFee", "20.00");
fakeform.Add("transportFeeExtra", "8.00");
fakeform.Add("status", "43"); // active work order
fakeform.Add("contactName", "test script contact name");
//fakeform.Add("workerRequests", "30123,301234,30122,12345");
_serv = new Mock<IWorkOrderService>();
_empServ = new Mock<IEmployerService>();
_waServ = new Mock<IWorkAssignmentService>();
_reqServ = new Mock<IWorkerService>();
_wrServ = new Mock<IWorkerRequestService>();
workerRequest = new List<WorkerRequest> { };
lcache = new Mock<ILookupCache>();
dbfactory = new Mock<IDatabaseFactory>();
_ctrlr = new WorkOrderController(_serv.Object, _waServ.Object, _empServ.Object, _reqServ.Object, _wrServ.Object, lcache.Object);
_ctrlr.SetFakeControllerContext();
// TODO: Include Lookups in Dependency Injection, remove initialize statements
Lookups.Initialize(lcache.Object, dbfactory.Object);
}
示例7: GetValidformCollection
private FormCollection GetValidformCollection()
{
FormCollection formCollection = new FormCollection();
formCollection.Add("CommunicationTypeName", "test");
formCollection.Add("CommunicationGroupId","1");
return formCollection;
}
示例8: GetInvalidformCollection
private FormCollection GetInvalidformCollection()
{
FormCollection formCollection = new FormCollection();
formCollection.Add("CustomFieldText", string.Empty);
formCollection.Add("ModuleId", string.Empty);
formCollection.Add("DataTypeID", string.Empty);
return formCollection;
}
示例9: GetInvalidformCollection
private FormCollection GetInvalidformCollection()
{
FormCollection formCollection = new FormCollection();
formCollection.Add("DocumentTypeID", string.Empty);
formCollection.Add("DocumentDate", string.Empty);
formCollection.Add("EntityID", string.Empty);
formCollection.Add("CreatedBy", string.Empty);
formCollection.Add("CreatedDate", string.Empty);
return formCollection;
}
示例10: FormCollection
public void Given_a_valid_form_collection_When_MapCreateRequests_is_called_Then_returns_collection_of_NewlyAddedDocumentGridRowViewModel()
{
//Given
var formCollection = new FormCollection();
formCollection.Add("NotRelevantKey", "Some Value");
formCollection.Add("DocumentGridRow_20000_DocumentLibraryId", "2000");
formCollection.Add("DocumentGridRow_20000_FileName", "Test File 1.txt");
formCollection.Add("DocumentGridRow_20000_Description", "First test file.");
formCollection.Add("DocumentGridRow_20000_DocumentType", "6");
formCollection.Add("DocumentGridRow_20001_DocumentLibraryId", "2001");
formCollection.Add("DocumentGridRow_20001_FileName", "Test File 2.txt");
formCollection.Add("DocumentGridRow_20001_Description", "Second test file.");
formCollection.Add("DocumentGridRow_20001_DocumentType", "7");
//When
var documentRequestMapper = new DocumentRequestMapper();
var newlyAddedDocumentGridRowViewModels = documentRequestMapper.MapCreateRequests(formCollection);
//Then
Assert.AreEqual(2, newlyAddedDocumentGridRowViewModels.Count);
Assert.AreEqual(20000L, newlyAddedDocumentGridRowViewModels[0].DocumentLibraryId);
Assert.AreEqual("Test File 1.txt", newlyAddedDocumentGridRowViewModels[0].Filename);
Assert.AreEqual("First test file.", newlyAddedDocumentGridRowViewModels[0].Description);
Assert.AreEqual(6L, (long)newlyAddedDocumentGridRowViewModels[0].DocumentType);
Assert.AreEqual(20001L, newlyAddedDocumentGridRowViewModels[1].DocumentLibraryId);
Assert.AreEqual("Test File 2.txt", newlyAddedDocumentGridRowViewModels[1].Filename);
Assert.AreEqual("Second test file.", newlyAddedDocumentGridRowViewModels[1].Description);
Assert.AreEqual(7L, (long)newlyAddedDocumentGridRowViewModels[1].DocumentType);
}
示例11: AddServiceOrderTest
public void AddServiceOrderTest()
{
string userName = "adminGlobal";
FormCollection formCollection = new FormCollection();
formCollection.Add("Client", "BB4439C8-E0CA-4725-8108-56C788495ACB");
formCollection.Add("BookingNumber", "");
formCollection.Add("OrderNumber", "");
List<BusinessApplicationByUser> businessApplicationsByUser = AuthorizationBusiness.GetBusinessApplicationsByUser(userName);
Guid businessApplicationId = businessApplicationsByUser.FirstOrDefault().Id;
ServiceOrderBusiness.AddServiceOrder(formCollection, businessApplicationId, userName);
}
示例12: CreateToDoFormCollection
public static FormCollection CreateToDoFormCollection()
{
var form = new FormCollection();
form.Add("Title", " Buy Bread");
return form;
}
示例13: ToFormCollection
/// <summary>
/// Converts a route value dictionary to a form collection
/// </summary>
/// <param name="items"></param>
/// <returns></returns>
public static FormCollection ToFormCollection(this RouteValueDictionary items)
{
var formCollection = new FormCollection();
foreach (var i in items)
{
formCollection.Add(i.Key, i.Value != null ? i.Value.ToString() : null);
}
return formCollection;
}
示例14: Create
public ActionResult Create( FormCollection form )
{
var badgesTable = new BadgesTable();
form.Add( "creationdate", DateTime.Now.ToString() );
var badge = badgesTable.Insert( form ); // TODO: get rid of mass assignment
return RedirectToAction( "Index" );
}
示例15: Given_a_valid_form_collection_When_MapDeleteRequests_is_called_Then_returns_a_list_of_ids
public void Given_a_valid_form_collection_When_MapDeleteRequests_is_called_Then_returns_a_list_of_ids()
{
//Given
var formCollection = new FormCollection();
formCollection.Add("NotRelevantKey", "Some Value");
formCollection.Add("PreviouslyAddedDocumentsRow_20004_Delete", "true,false");
formCollection.Add("PreviouslyAddedDocumentsRow_20005_Delete", "false");
formCollection.Add("PreviouslyAddedDocumentsRow_20006_Delete", "true,false");
//When
var documentRequestMapper = new DocumentRequestMapper();
var documentLibraryIdsToDelete =
documentRequestMapper.MapDeleteRequests(formCollection);
//Then
Assert.AreEqual(2, documentLibraryIdsToDelete.Count);
Assert.IsTrue(documentLibraryIdsToDelete.Contains(20004L));
Assert.IsFalse(documentLibraryIdsToDelete.Contains(20005L));
Assert.IsTrue(documentLibraryIdsToDelete.Contains(20006L));
}