public JsonResult AddCharacter(string questionId, double x, double y, double width, double height) { UpdateList(); AnimateViewModel a = new AnimateViewModel(); a = GetAnimatesType((listImageType.Where(z => z.Type == "Character")).FirstOrDefault().Id, new Guid(questionId)); if (a != null) { //var cek = listImage.Where(im => im.Name == imageName).FirstOrDefault().Id; if (height != 0) { a.Height = height; } if (width != 0) { a.Width = width; } a.PosX = x; a.PosY = y; a.UpdateAnimate(); return(Json(a, JsonRequestBehavior.AllowGet)); } return(Json(a, JsonRequestBehavior.AllowGet)); }
public JsonResult AddAnimates(string imageType, string imageName, string questionId, double x, double y, double width, double height) { var c = imageName; UpdateList(); AnimateViewModel a = new AnimateViewModel(); a = GetAnimatesType(new Guid(imageType), new Guid(questionId)); if (a != null) { //var cek = listImage.Where(im => im.Name == imageName).FirstOrDefault().Id; a.ImageId = new Guid(imageName); if (height != 0) { a.Height = height; } if (width != 0) { a.Width = width; } a.PosX = x; a.PosY = y; a.UpdateAnimate(); return(Json(a, JsonRequestBehavior.AllowGet)); } else { a = new AnimateViewModel(); a.Id = Guid.NewGuid(); a.ImageId = new Guid(imageName); a.QuestionId = new Guid(questionId); a.Height = i.GetType((Guid)a.ImageId).Height; a.Width = i.GetType((Guid)a.ImageId).Width; a.PosX = 0; a.PosY = 0; //brutal if (imageType == "Background") { a.Depth = 0; } else if (imageType == "Dialog") { a.Depth = 1; } else if (imageType == "Character") { a.Depth = 2; } a.AddAnimate(); return(Json(a, JsonRequestBehavior.AllowGet)); } }