public ActionResult Edit(VesselVisitModel model)
        {
            var automapperModel = AutoMapper.Mapper.Map<VesselVisit>(model);
            VesselVisit teacher = context.VesselVisit.SingleOrDefault(x => x.id == automapperModel.id);

            context.Entry(teacher).CurrentValues.SetValues(automapperModel);
            context.SaveChanges();

            return RedirectToAction("Index");
        }
        public ActionResult Create(VesselVisitModel model)
        {
            if (ModelState.IsValid)
            {

                var automapperVesselVisit = AutoMapper.Mapper.Map<VesselVisit>(model);
                context.VesselVisit.Add(automapperVesselVisit);
                context.SaveChanges();

                return RedirectToAction("Index", "ContainerAndVesselVisit");

            }
            return RedirectToAction("Index", "ContainerAndVesselVisit");
        }
        public ActionResult Index()
        {
            List<VesselVisit> visitEntity = new List<VesselVisit>();

            try
            {
                visitEntity = (from r in context.VesselVisit

                    select r).ToList();
            }
            catch (Exception e)
            {

                Console.WriteLine(e);
            }

            List<VesselVisitModel> visitModels = new List<VesselVisitModel>();
            foreach (var visit in visitEntity)
            {
                visitModels.Add(AutoMapper.Mapper.Map<VesselVisitModel>(visit));
            }

            ObjectModal  vessel = new ObjectModal();
            Type modelObject = new VesselVisitModel().GetType();

            PropertyInfo[] infoProperties = modelObject.GetProperties();

            foreach (var property in infoProperties)
            {
                vessel.PropertiesName.Add(property);
            }
                foreach (var entity in visitEntity)
                {

                ObjectProperties currentProperties = new ObjectProperties();
                foreach (var propertyInfo in entity.GetType().GetProperties())
                {

                    var propertyAttributes = Attribute.GetCustomAttributes(propertyInfo);

                    object value = propertyInfo.GetValue(entity, null);
                        currentProperties.PropertiesData.Add(value);

                    }
                vessel.AllObjects.Add(currentProperties);
                }

            return RedirectToAction("Index", "MasterView",new ObjectModal {AllObjects = vessel.AllObjects});
        }