示例#1
0
        public ActionResult Index(long?id)
        {
            var model = new AddItemRequest();

            if (id.HasValue)
            {
                try {
                    var getOfferResult = BloodSearchModelsRemoteProvider.GetOffer(id.Value);
                    if (getOfferResult.UserId != User.UserId)
                    {
                        return(Redirect("/"));
                    }
                    model = AddItemRequest.FromOfferResult(getOfferResult);
                } catch {
                    return(Redirect("/"));
                }
            }
            else
            {
                model.Name  = User.Name;
                model.Phone = User.Phone;
                model.Email = User.Email;
            }

            return(View(model));
        }
示例#2
0
        public ActionResult Index(long id)
        {
            var model = new GetOfferResult();

            try {
                model = BloodSearchModelsRemoteProvider.GetOffer(id);
            }
            catch {
                return(Redirect("/"));
            }
            return(View(model));
        }