public ActionResult Profile(long id) { var profile = repository.GetShippingProfiles(subdomainid.Value).Single(x => x.id == id); var sd = profile.MASTERsubdomain; var usr = repository.GetUserById(sessionid.Value, subdomainid.Value); var settings = (UserSettings)usr.settings; var viewdata = new ShippingProfile() { currency = sd.currency.ToCurrency(), shippingGroups = repository.GetShippingRules(id, subdomainid.Value).ToModel( sd.currency.ToCurrency(), settings.HasFlag(UserSettings.METRIC_VIEW)), id = profile.id, type = profile.type.ToEnum <ShippingProfileType>(), shipwireEnabled = !string.IsNullOrEmpty(profile.MASTERsubdomain.shipwireEmail), IsPermanent = profile.permanent }; // set everywhere else cost string everywhereElseCost; viewdata.flatrateRules = repository.GetShippingRules(id, subdomainid.Value).ToFlatRateModel( sd.currency.ToCurrency(), out everywhereElseCost); viewdata.everywhereElseCost = everywhereElseCost; if (!string.IsNullOrEmpty(viewdata.everywhereElseCost)) { viewdata.applyEverywhereElseCost = true; } return(View(viewdata)); }
public ActionResult Settings(decimal?[] shipping_cost, int?[] shipping_destination, long?shippingProfileID, ShippingProfileType shippingType) { if (shippingProfileID.HasValue) { // delete existing rules in profile if (shippingType == ShippingProfileType.FLATRATE) { ShippingProfile.UpdateFlatrateShipping(shippingProfileID.Value, shipping_cost, shipping_destination, subdomainid.Value); } } return(Json(OPERATION_SUCCESSFUL.ToJsonOKData())); }