Click here to Skip to main content
15,922,512 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I need to create cms type pages without using third parties like umbraco,joomla,drupal etc..only i wanted to use asp.net C# coding..there have any examples...
Posted
Updated 29-Apr-14 20:37pm
v2
Comments
[no name] 30-Apr-14 7:35am    
Probably. Have you made any effort at all to go finding an example?
Nelek 30-Apr-14 12:43pm    
In addition to the solution 1 and to help you in future questions, please read:
What have you tried?[^]
and best way to post code snippets[^]

Hello

cms is nothing lase then database driven application

use advantage of VS and c# and that its easy to create that connections I will use MVC on start

before layout i will create a functionality

for example by creating Models what will specify some of the functionality Banner Logo or some graphic


for Logo i will use something like

C#
public byte[] Logo { get; set; }

        [HiddenInput(DisplayValue = true)]
        public string logoMimeType { get; set; }


that's example for keeping it in database but u can do it in folder to up to u of corse folder will be better for websites

That will be ur model

the set up a controller

C#
[HttpPost]
      [ValidateAntiForgeryToken]
      public ActionResult Edit([Bind(Include = "MyLogoID,Logo,ImageMimeType")] 
MyLogo mylogo, HttpPostedFileBase image)
      {
          if (ModelState.IsValid)
          {
              if (image != null) {
                  mylogo.logoMimeType = image.ContentType;
                  mylogo.Logo = new byte[image.ContentLength];
                  image.InputStream.Read(mylogo.Logo, 0, image.ContentLength);
              }
              db.Entry(mylogo).State = EntityState.Modified;
              TempData["message"] = string.Format("{0} has beensaved",     mylogo.Name);
              db.SaveChanges();
              return RedirectToAction("Index");
          }
          return View(Logo);
      }



now create something what will pull the logo from database or folder


SQL
public FileContentResult GetImage(int mylogoId)
       { MyLogo emp = db.MyLogo.FirstOrDefault(p => p.MyLogoID == mylogoId);
           if (emp != null) {
               return File(emp.Logo, emp.logoMimeType);
           } else {
               return null;
           }
       }


and now we need to get something what will put that all to the view and in place on website


<img width="150" height="150" src="@Url.Action("GetImage", "Mylogo", new { Model.MyLogoID })" />


or u can use HTML helper

I probably miss miss something xD

but u just have one functionality u can add Logo to the web now and store it in database !


hope i dont need to show u how to create form and view to it to upload and use of the controller
 
Share this answer
 
v2
Comments
SebSCO 30-Apr-14 13:48pm    
rest its just CSS and HTML after u do all functions create menu attach functions to the menu and then CSS for color or position on the web and that's u
Remember u can modify ur HTML helpers add new on with different ID or Classes what will automatically add to the view code then some extra JS/Jquerry and ur at home :)
There are likely some examples on google but there is clearly not enough space here to explain it all to you. I would suggest searching for some example articles or just getting started on it and then come back when you have a specific question.
 
Share this answer
 

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