Esempio n. 1
0
        public ActionResult ModalUpdateDB(string Name, string Gender, string DateOfBirth, string Bio)
        {
            Actor actor;

            try
            {
                actor = new Actor {
                    Name = Name, Gender = Gender, DateOfBirth = DateTime.Parse(DateOfBirth), Bio = Bio
                };
            }
            catch (Exception e)
            {
                actor = new Actor {
                    Name = Name, Gender = Gender, Bio = Bio
                };
            }

            actorsRepository.AddActor(actor);

            JObject jObject = JObject.FromObject(actor);

            System.Diagnostics.Debug.WriteLine("Actor id : " + actor.Id.ToString());

            return(Content(jObject.ToString(), "application/json"));
        }
Esempio n. 2
0
        public JsonResult AddActor(AddMovieViewModel actor)
        {
            try {
                var newActor = new Actors()
                {
                    Name = actor.AName,
                    Bio  = actor.ABio,
                    Dob  = actor.ADob,
                    Sex  = actor.ASex,
                };

                actor.AId = actorsRepository.AddActor(newActor);
            }
            catch (Exception e) { string s = e.HelpLink; }
            return(Json(actor));
        }