Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. UpdateModel vs Request.Form..

UpdateModel vs Request.Form..

Scheduled Pinned Locked Moved ASP.NET
questioncsharpdatabasevisual-studiolinq
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Quake2Player
    wrote on last edited by
    #1

    Hi, Is there a reason one would prefere Request.Form instead of the UpdateModel(..)? Another question: If one haves a class (generated by linq to sql) with two properties like: SomethingId, Something Being SomethingId an int and Something the object, For example: Table Messages {...,FromId, ..} is mapped to Class Message {...,FromId, From, ...} Being From an object of lets say type User So, my question is how is the procedure to edit these kind of objects if I'm using Request.Form? Between A and B: Way A: 1. Retrieve the object obj being edited from the repository, obj = objsRepository.RetrieveById(..) 2. x = Request.Form["SomethingId"] 3. obj.SomethingId = x vs Way B: 1. Retrieve the object obj being edited from the repository, obj = objsRepository.RetrieveById(..) 2. x = Request.Form["SomethingId"] 3. xAsObject = somethingsRepository.RetrieveById(x) 4. obj.Something = xAsObject Which one is the correct way ?? (Of course in my form I wont have "objects".. just strings)

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups