Click here to Skip to main content
15,885,662 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more: , +
C#
public class tbl_mainProducts
   {
       public int ID { get; set; }
       public string str_CatID { get; set; }
       public string str_SpeialDietID { get; set; }
       public string str_BrandID { get; set; }
       public string str_Description { get; set; }
       public string str_Summery { get; set; }
       public string str_Imagepath { get; set; }
       public string dt_Date { get; set; }
       public decimal dec_Price { get; set; }
       public int int_Qty { get; set; }

   }
   public class tbl_mainProductsContext : DbContext
   {
       public DbSet<tbl_mainProducts> mainprod { get; set; }
   }


i have a html textbox in basket View.. i have to get value  from textbox and update the basket
Posted
Updated 26-Sep-14 21:12pm
v4
Comments
Suvabrata Roy 26-Sep-14 3:04am    
What you required? and what what you done so far?
Kenneth Haugland 26-Sep-14 7:18am    
Dont repost, use the Improve question instead

1 solution

try the below method
C#
public bool UpdateProduct(tbl_mainProducts entityChanges, long id)
       {
           try
           {
               using (tbl_mainProductsContext dataContext = new tbl_mainProductsContext())
               {
                   var updatedData = mainprod.FirstOrDefault(x=>x.Id==id);
                   dataContext.Achievement.Attach(updatedData );
                   dataContext.Entry(updatedData ).State = EntityState.Modified;
                   dataContext.SaveChanges();
                   return true;
               }
           }
           catch (Exception exception)
           {
               return false;
           }

       }

Hope this helps
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900