Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpPost]
- [ValidateAntiForgeryToken]
- [AllowAnonymous]
- public ActionResult Create(Station station)
- {
- station.FileName = station.File.FileName;
- station.ImageSize = station.File.ContentLength;
- byte[] data = new byte[station.File.ContentLength];
- station.File.InputStream.Read(data, 0, station.File.ContentLength);
- station.ImageData = data;
- db.Stations.Add(station);
- db.SaveChanges();
- return RedirectToAction("Index");
- }
- public class Station
- {
- [Key]
- public int Id { get; set; }
- [Display(Name="Station Name")]
- public string StationName { get; set; }
- public double Distance { get; set; }
- [DataType(DataType.PhoneNumber)]
- public string Mobile { get; set; }
- [DataType(DataType.Date)]
- public DateTime Opening { get; set; }
- public string Connections { get; set; }
- public string Layout { get; set; }
- [Display(Name="Tourists Place")]
- public string TouristsPlace { get; set; }
- [Display(Name = "Tourists Place Image")]
- /////////
- public int ImageId { get; set; }
- public Nullable<int> ImageSize { get; set; }
- public string FileName { get; set; }
- public byte[] ImageData { get; set; }
- [Required(ErrorMessage = "Please select file")]
- public HttpPostedFileBase File { get; set; }
- /// <summary>
- /// ////
- /// </summary>
- [Display(Name="Line Color")]
- public string LineColor { get; set; }
- }
- [NotMapped]
- public HttpPostedFileBase File { get; set; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement